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/. */
9 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
14 #error "Architecture not supported"
18 int main(int argc, char **argv)
20 #if defined(OMIT_LIB_BUILD_TIME)
22 * Some platforms don't have any 64-bit integer type
23 * such as 'long long'. Because we can't use NSPR's
24 * PR_snprintf in this program, it is difficult to
25 * print a static initializer for PRInt64 (a struct).
26 * So we print nothing. The makefiles that build the
27 * shared libraries will detect the empty output string
28 * of this program and omit the library build time
29 * in PRVersionDescription.
31 #elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
34 #ifdef HAVE_SVID_GETTOD
37 gettimeofday(&tv, NULL);
39 now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec;
41 fprintf(stdout, "%ld", now);
42 #elif defined(BEOS) && defined(__POWERPC__)
43 fprintf(stdout, "%Ld", now); /* Metroworks on BeOS PPC */
45 fprintf(stdout, "%lld", now);
51 GetSystemTimeAsFileTime(&ft);
52 CopyMemory(&now, &ft, sizeof(now));
54 * 116444736000000000 is the number of 100-nanosecond intervals
55 * between Jan. 1, 1601 and Jan. 1, 1970.
58 now = (now - 116444736000000000LL) / 10LL;
59 fprintf(stdout, "%lld", now);
61 now = (now - 116444736000000000i64) / 10i64;
62 fprintf(stdout, "%I64d", now);
66 #error "Architecture not supported"