How do you create a UTC time in C for a specific day, month and year?

David picture David · Jul 15, 2009 · Viewed 8.3k times · Source

How do I create a UTC time in C for the following date:

1st July 2038

using standard ANSI C function calls (given that the tm_year element of the tm structure cannot be greater than 137) ?

Answer

Aric TenEyck picture Aric TenEyck · Jul 15, 2009

You don't. The 32-bit ANSI C time_t rolls over in 2038. It's like asking how you create July 23, 2003 in your old 2-digit-year COBOL system.