1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include <stdio.h> 7 #include <time.h> 8 main(int argc,char ** argv)9int main(int argc, char **argv) 10 { 11 #if defined(OMIT_LIB_BUILD_TIME) 12 /* 13 * Some platforms don't have any 64-bit integer type 14 * such as 'long long'. Because we can't use NSPR's 15 * PR_snprintf in this program, it is difficult to 16 * print a static initializer for PRInt64 (a struct). 17 * So we print nothing. The makefiles that build the 18 * shared libraries will detect the empty output string 19 * of this program and omit the library build time 20 * in PRVersionDescription. 21 */ 22 #elif defined(_MSC_VER) 23 __int64 now; 24 time_t sec; 25 26 sec = time(NULL); 27 now = (1000000i64) * sec; 28 fprintf(stdout, "%I64d", now); 29 #else 30 long long now; 31 time_t sec; 32 33 sec = time(NULL); 34 now = (1000000LL) * sec; 35 fprintf(stdout, "%lld", now); 36 #endif 37 38 return 0; 39 } /* main */ 40 41 /* now.c */ 42