tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

now.c (1116B)


      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 
      9 int main(int argc, char** argv) {
     10 #if defined(OMIT_LIB_BUILD_TIME)
     11  /*
     12   * Some platforms don't have any 64-bit integer type
     13   * such as 'long long'.  Because we can't use NSPR's
     14   * PR_snprintf in this program, it is difficult to
     15   * print a static initializer for PRInt64 (a struct).
     16   * So we print nothing.  The makefiles that build the
     17   * shared libraries will detect the empty output string
     18   * of this program and omit the library build time
     19   * in PRVersionDescription.
     20   */
     21 #elif defined(_MSC_VER)
     22  __int64 now;
     23  time_t sec;
     24 
     25  sec = time(NULL);
     26  now = (1000000i64) * sec;
     27  fprintf(stdout, "%I64d", now);
     28 #else
     29  long long now;
     30  time_t sec;
     31 
     32  sec = time(NULL);
     33  now = (1000000LL) * sec;
     34  fprintf(stdout, "%lld", now);
     35 #endif
     36 
     37  return 0;
     38 } /* main */
     39 
     40 /* now.c */