[...]

Quote:

>I'm looking for the PROCEDURE to calculate the date, time etc of a file,

>given its integer value since 1970. I do not want references to a C

>function or any other language on how to do it, I just want the proc used.

[...]

You need to specify your problem more clearly. What is your input?

integer value IN WHAT UNIT since 1970? A more correct formulation of

the problem might be:

"Given an integer number of seconds since 00:00, Jan 1, 1970,

what is the time/date represented?"

Notice that I filled in details that are crucial to the computation

that you did not specify.

Now, after you've formulated your question properly, how about giving

it some thinking yourself? Here's a trivial solution:

n = number of seconds since start of 1970, your input

year = 1970

calculate_year:

if (year is a leap year)

if (n > number of seconds in a leap year)

n -= number of seconds in a leap year

year++

else

goto calculate_months

else

if (n > number of seconds in a non-leap year)

n -= number of seconds in a non-leap year

year++

else

goto calculate_months

goto calculate_year

calculate_months:

month = january

if (n > number of seconds in january)

n -= number of seconds in january

month++

else

goto done

if (year is a leap year)

if (n > number of seconds in a leap year february)

n -= number of seconds in a leap year february

else

goto done

else

if (n > number of seconds in a non-leap year february)

n -= number of seconds in a non-leap year february

else

goto done

[and so on and so forth]

done:

day = 1 + n / number of seconds in a day

[at this point (year, month, day) is the date represented by n]

The above should get you a grade of about C, if this is a homework

problem. It's a pretty simpleminded and stupid solution, but it looks

too much like a homework problem to give it much thought.