1 // RUN: %clang_cc1 -source-date-epoch 0 -E %s | FileCheck %s --check-prefix=19700101 2 3 // 19700101: const char date[] = "Jan 1 1970"; 4 // 19700101-NEXT: const char time[] = "00:00:00"; 5 // 19700101-NEXT: const char timestamp[] = "Thu Jan 1 00:00:00 1970"; 6 7 // RUN: %clang_cc1 -source-date-epoch 2147483647 -E -Wdate-time %s 2>&1 | FileCheck %s --check-prefix=Y2038 8 9 // Y2038: warning: expansion of date or time macro is not reproducible [-Wdate-time] 10 // Y2038: const char date[] = "Jan 19 2038"; 11 // Y2038-NEXT: const char time[] = "03:14:07"; 12 // Y2038-NEXT: const char timestamp[] = "Tue Jan 19 03:14:07 2038"; 13 14 /// Test a large timestamp if the system uses 64-bit time_t and known to support large timestamps. 15 // RUN: %if !system-windows && clang-target-64-bits %{ %clang_cc1 -source-date-epoch 253402300799 -E -Wdate-time %s 2>&1 | FileCheck %s --check-prefix=99991231 %} 16 17 // 99991231: warning: expansion of date or time macro is not reproducible [-Wdate-time] 18 // 99991231: const char date[] = "Dec 31 9999"; 19 // 99991231-NEXT: const char time[] = "23:59:59"; 20 // 99991231-NEXT: const char timestamp[] = "Fri Dec 31 23:59:59 9999"; 21 22 // RUN: not %clang_cc1 -source-date-epoch 253402300800 -E %s 2>&1 | FileCheck %s --check-prefix=TOOBIG 23 24 // TOOBIG: error: environment variable 'SOURCE_DATE_EPOCH' ('253402300800') must be a non-negative decimal integer <= {{(2147483647|253402300799)}} 25 26 // RUN: not %clang_cc1 -source-date-epoch 0x0 -E %s 2>&1 | FileCheck %s --check-prefix=NOTDECIMAL 27 28 // NOTDECIMAL: error: environment variable 'SOURCE_DATE_EPOCH' ('0x0') must be a non-negative decimal integer <= {{(2147483647|253402300799)}} 29 30 const char date[] = __DATE__; 31 const char time[] = __TIME__; 32 const char timestamp[] = __TIMESTAMP__; 33