# Max value of system clock

Hi,
Can anybody tell me how to get the maximum value supported by the system clock? I understand that it is December 31, 2038, but how to access this value? In which header file is it defined? OR which function will return me this value?

Thanks,
Uday

The 2038 date is the end of the epoch on which the type time_t is based. This is because time_t is actually a uint32_t which is measured as seconds from start of the epoch. The epoch started on January 1, 1970 and 4 billion (approx) seconds from there is 2038.

This is all part of the ansi standard for the C programming language (I believe).

So what are you trying to accomplish? If you were not talking about time_t, then the 2038 limit may not apply.

Rick…

Rick under QNX4 time_t is signed hence 2038, if it were unsigned (like in QNX6) it would be 21??.

I don’t beleive the C standard specify how big time_t is. It could be 64 bit. I think it’s implementation specific.

Argh Mario, you made me go try to find some authoritative references for the answer.

So, we continue to search.

[quote=“ISO C99 Rationale”]

7.23.1 Components of time
The types clock_t and time_t are arithmetic because values of these types must, in
accordance with existing practice, on occasion be compared with â€“1 (a â€œdonâ€™t-knowâ€

[quote=“rick”]

[quote=“ISO C99 Rationale”]

7.23.1 Components of time
The types clock_t and time_t are arithmetic because values of these types must, in
accordance with existing practice, on occasion be compared with â€“1 (a â€œdonâ€™t-knowâ€

I am sure that is the interpretation which fits. Whether that was the intent or not is another question. If you use an unsigned base type, that means their are two meanings of the max value (assuming two’s compliment) - it can either be the maximum value or it can be the don’t know value.

Rick…

Regarding the QNX 2.xx time, my documentation states that the new date is a signed long containing the number of seconds since Jan 1, 1980, not since Jan 1 1970. This would make dates correct up until 2048, not 2038. Or is my (admittedly old) documentation incorrect now? Or is my (also old) brain failing me again. Anyone remember which version changed to the new format of date? Some of my old QNX files are stored under old date formats, some are new, and trying to list dates before or after specific dates is a disaster.
My versions of QNX range from 1.2/2.0 release 5 (5, 5A and 5B) up: 1.25B, 2.05B, 2.11, 2.11C, 2.13B, 2.15E, 2.15G, 2.15H and 2.21. Also includes BASIC version 2.0 as well as C compilers, QDOS/DFS, DITTO, etc. Unfortunately all are on 5 1/4" diskettes, except for one 3.5" 2.21 upgrade.

As far as I know, QNX 2, never changed from a base of 1980 to 1970. I don’t recall when they added the unix like format, but it was probably around the transition from versions 1 to 2.