nsprpub/config/now.c

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 #include <stdio.h>
     7 #include <time.h>
     9 int 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;
    26     sec = time(NULL);
    27     now = (1000000i64) * sec;
    28     fprintf(stdout, "%I64d", now);
    29 #else
    30     long long now;
    31     time_t sec;
    33     sec = time(NULL);
    34     now = (1000000LL) * sec;
    35     fprintf(stdout, "%lld", now);
    36 #endif
    38     return 0;
    39 }  /* main */
    41 /* now.c */

mercurial