Back to index

lightning-sunbird  0.9+nobinonly
now.c File Reference
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.


int main (int argc, char **argv)
 The Xalan testcases app.

Function Documentation

int main ( int  argc,
char **  argv 

The Xalan testcases app.

Definition at line 54 of file now.c.

#if defined(OMIT_LIB_BUILD_TIME)
     * Some platforms don't have any 64-bit integer type
     * such as 'long long'.  Because we can't use NSPR's
     * PR_snprintf in this program, it is difficult to
     * print a static initializer for PRInt64 (a struct).
     * So we print nothing.  The makefiles that build the
     * shared libraries will detect the empty output string
     * of this program and omit the library build time
     * in PRVersionDescription.
#elif defined(VMS)
    long long now;
    struct timeb b;
    now = b.time;
    now *= 1000000;
    now += (1000 * b.millitm);
    fprintf(stdout, "%Ld", now);
#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
    long long now;
    struct timeval tv;
    gettimeofday(&tv, NULL);
    now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec;
#if defined(OSF1)
    fprintf(stdout, "%ld", now);
#elif defined(BEOS) && defined(__POWERPC__)
    fprintf(stdout, "%Ld", now);  /* Metroworks on BeOS PPC */
    fprintf(stdout, "%lld", now);

#elif defined(WIN32)
    __int64 now;
    FILETIME ft;
    CopyMemory(&now, &ft, sizeof(now));
     * 116444736000000000 is the number of 100-nanosecond intervals
     * between Jan. 1, 1601 and Jan. 1, 1970.
#ifdef __GNUC__
    now = (now - 116444736000000000LL) / 10LL;
    fprintf(stdout, "%lld", now);
    now = (now - 116444736000000000i64) / 10i64;
    fprintf(stdout, "%I64d", now);

#elif defined(XP_OS2_VACPP)
/* no long long or i64 so we use a string */
#include <string.h>
  char buf[24];
  char tbuf[7];
  time_t now;
  long mtime;
  int i;

  struct timeb b;
  now = b.time;
  _ltoa(now, buf, 10);

  mtime = b.millitm * 1000;
  if (mtime == 0){
    strcat(buf, "000000");
  } else {
     _ltoa(mtime, tbuf, 10);
     for (i = strlen(tbuf); i < 6; ++i)
       strcat(buf, "0");
     strcat(buf, tbuf);
  fprintf(stdout, "%s", buf);

#error "Architecture not supported"

    return 0;
}  /* main */

Here is the call graph for this function: