-} /* GetCurrentAbsoluteTime() */
-
-
-/* GetCurrentAbsoluteTimeUsec()
- * Get the current system time. Set timezone parameters if not specified elsewhere.
- * Define HasCTZSet to allow clients to specify the default timezone.
- *
- * Returns the number of seconds since epoch (January 1 1970 GMT)
- */
-AbsoluteTime
-GetCurrentAbsoluteTimeUsec(int *usec)
-{
- time_t now;
- struct timeval tp;
-
-#ifdef NOT_USED
- struct timezone tpz;
-#endif
-#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
- struct tm *tm;
-
-#else
- struct timeb tb; /* the old V7-ism */
-#endif
-
- gettimeofday(&tp, NULL);
-
- now = tp.tv_sec;
- *usec = tp.tv_usec;
-
-#ifdef NOT_USED
-#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
- now = time(NULL);
-#else
- ftime(&tb);
- now = tb.time;
-#endif
-#endif
-
- if (!HasCTZSet)
- {
-#if defined(HAVE_TM_ZONE)
- tm = localtime(&now);
-
- CTimeZone = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */
- CDayLight = (tm->tm_isdst > 0);
-
-#ifdef NOT_USED
-
- /*
- * XXX is there a better way to get local timezone string w/o
- * tzname? - tgl 97/03/18
- */
- strftime(CTZName, MAXTZLEN, "%Z", tm);
-#endif
-
- /*
- * XXX FreeBSD man pages indicate that this should work - thomas
- * 1998-12-12
- */
- strcpy(CTZName, tm->tm_zone);
-
-#elif defined(HAVE_INT_TIMEZONE)
- tm = localtime(&now);
-
- CDayLight = tm->tm_isdst;
- CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
- strcpy(CTZName, tzname[tm->tm_isdst]);
-#else /* neither HAVE_TM_ZONE nor
- * HAVE_INT_TIMEZONE */
- CTimeZone = tb.timezone * 60;
- CDayLight = (tb.dstflag != 0);
-
- /*
- * XXX does this work to get the local timezone string in V7? -
- * tgl 97/03/18
- */
- strftime(CTZName, MAXTZLEN, "%Z", localtime(&now));
-#endif
- };
-
- return (AbsoluteTime) now;
-} /* GetCurrentAbsoluteTimeUsec() */
-
-
-void
-GetCurrentDateTime(struct tm * tm)
-{
- int tz;
-
- abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);
-
- return;
-} /* GetCurrentDateTime() */
-
-
-void
-GetCurrentTimeUsec(struct tm * tm, fsec_t *fsec)
-{
- int tz;
- int usec;
-
- abstime2tm(GetCurrentTransactionStartTimeUsec(&usec), &tz, tm, NULL);
-#ifdef HAVE_INT64_TIMESTAMP
- *fsec = usec;
-#else
- *fsec = usec * 1.0e-6;
-#endif
-
- return;
-} /* GetCurrentTimeUsec() */