Created
April 7, 2015 19:11
-
-
Save omalley/f98dc64786933a53da22 to your computer and use it in GitHub Desktop.
Revisions
-
omalley created this gist
Apr 7, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #include <stdio.h> #include <time.h> /* Demonstrates the Mac OS bug for 2038. The output on Mac OS/X 10.10.2 in PDT: In 2036 2093587200 - 2093562000 = 25200 In 2037 2125126800 - 2125101600 = 25200 In 2038 2156666400 - 2156637600 = 28800 In 2039 2188202400 - 2188173600 = 28800 */ int main(int argc, char *argv[]) { struct tm timeStruct; timeStruct.tm_sec = 0; timeStruct.tm_min = 0; timeStruct.tm_hour = 0; timeStruct.tm_mday = 5; timeStruct.tm_mon = 4; for(int year=2036; year < 2040; ++year) { timeStruct.tm_year = year - 1900; time_t local = mktime(&timeStruct); time_t utc = timegm(&timeStruct); printf("In %d %ld - %ld = %ld\n", year, local, utc, local - utc); } }