Does the standard C ctime
function return the Gregorian calendar date? In particular, I want to verify that it will account for leap years and thus display Feb 29
for the respective dates.
Asked
Active
Viewed 168 times
1 Answers
1
For times in the future and in the recent past, yes. For times before the Gregorian calendar reform... I don’t know, but those times are only relevant on systems with 64 bit time_t
.

Edgar Bonet
- 3,416
- 15
- 18
-
I think my uncertainty comes from *section 7.23.1 paragraph 1* of the C99 standard: `Many functions deal with a calendar time that represents the current date (according to the Gregorian calendar) and time.` The wording seems a bit ambiguous -- i.e. does it mean that if a function returns the representation of the current date, it must return it according to the Gregorian calendar? – Vilhelm Gray Jun 26 '13 at 14:38
-
It means, for example, that the `tm_mday`, `tm_mon` and `tm_year` fields of `struct tm` represent the day, month and year according to the Gregorian calendar. – Edgar Bonet Jun 26 '13 at 14:43