1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/config/now.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include <stdio.h> 1.10 +#include <time.h> 1.11 + 1.12 +int main(int argc, char **argv) 1.13 +{ 1.14 +#if defined(OMIT_LIB_BUILD_TIME) 1.15 + /* 1.16 + * Some platforms don't have any 64-bit integer type 1.17 + * such as 'long long'. Because we can't use NSPR's 1.18 + * PR_snprintf in this program, it is difficult to 1.19 + * print a static initializer for PRInt64 (a struct). 1.20 + * So we print nothing. The makefiles that build the 1.21 + * shared libraries will detect the empty output string 1.22 + * of this program and omit the library build time 1.23 + * in PRVersionDescription. 1.24 + */ 1.25 +#elif defined(_MSC_VER) 1.26 + __int64 now; 1.27 + time_t sec; 1.28 + 1.29 + sec = time(NULL); 1.30 + now = (1000000i64) * sec; 1.31 + fprintf(stdout, "%I64d", now); 1.32 +#else 1.33 + long long now; 1.34 + time_t sec; 1.35 + 1.36 + sec = time(NULL); 1.37 + now = (1000000LL) * sec; 1.38 + fprintf(stdout, "%lld", now); 1.39 +#endif 1.40 + 1.41 + return 0; 1.42 +} /* main */ 1.43 + 1.44 +/* now.c */