Source File : calendar.c
Historical Introduction:
Portugal was one of the first countries to adopt the Gregorian Calendar, in 1582. The calendar used until then was introduced by Julio Cesar in 46 B. C.. According to Julio Cesar, an average year had 365,25 days. To adjust this variation (0,25) it was assumed that, for every 3 years composed by 365 days (named common year) there should exist one with 366 days (leap year). So every 4 years (years multiples of 4), February would have 29 days instead of 28. Still, a small variation persisted (because the real mean average year is 365,242199 days). With Julio Cesars Calendar, for every 400 years, there would be a 3-day error (in excess), comparing with the real solar year. To adjust this other variation, the Gregorian Calendar uses the same logic. This time, reducing 1 day in each secular year (multiples of 100) non-multiple of 400. That is, reducing 1 day in the first, second and third century, and not reducing on the fourth. How could the reducing be done? Transforming a leap year in a common year. As you can see, all the secular years are also multiples of 4. So by the first reasoning (Cesar Calendar) they should be leap years. By the second reasoning (Gregorian Calendar) each secular year will only be leap year if it is multiple of 400.
This example will make the issue clear. Consider the period between
the years 1200 and 1600.
Input:
Consists of a set of numbers (one per line) between 0 and 4294967295,
each of which will represent a particular time of a particular day, in
seconds, from January 1st, 1980 to something around the
year 2115.
Output:
For each input line, you should print one string containing the time,
followed by the date (day, month and year) corresponding to the given input
number.
Do not forget not to use AM or PM. Do not use 11:7:8 PM to mean 11 hours, 7 minutes and 8 seconds after midday. Use 23:07:08 instead (and dont forget the zeros either).
This should be the output format:
hh:mm:ss DD/MM/YYYY
hh:mm:ss**DD/MM/YYYY¿
where hh, mm, ss, DD and MM are the 2 digits of the hours, minutes, seconds, days and months fields. YYYY are the 4 digits of the field year.
795007
0 644257835 |
795007¿
0¿ 644257835¿ ¿ |
04:50:07 10/01/1980
00:00:00 01/01/1980 16:30:35 31/05/2000 |
04:50:07 10/01/1980¿
00:00:00 01/01/1980¿ 16:30:35 31/05/2000¿ ¿ |