diff options
-rw-r--r-- | src/backend/utils/adt/nabstime.c | 29 | ||||
-rw-r--r-- | src/backend/utils/adt/timestamp.c | 20 |
2 files changed, 20 insertions, 29 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 6ecb41b98f5..2c8e7ad0551 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -1539,32 +1539,3 @@ bogus: "tinterval", i_string))); *i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */ } - - -/***************************************************************************** - * - *****************************************************************************/ - -/* - * timeofday - - * returns the current time as a text. similar to timenow() but returns - * seconds with more precision (up to microsecs). (I need this to compare - * the Wisconsin benchmark with Illustra whose TimeNow() shows current - * time with precision up to microsecs.) - ay 3/95 - */ -Datum -timeofday(PG_FUNCTION_ARGS) -{ - struct timeval tp; - char templ[128]; - char buf[128]; - pg_time_t tt; - - gettimeofday(&tp, NULL); - tt = (pg_time_t) tp.tv_sec; - pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z", - pg_localtime(&tt, session_timezone)); - snprintf(buf, sizeof(buf), templ, tp.tv_usec); - - PG_RETURN_TEXT_P(cstring_to_text(buf)); -} diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 284e14dd739..ba15a29ddbd 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -1610,6 +1610,26 @@ GetSQLLocalTimestamp(int32 typmod) } /* + * timeofday(*) -- returns the current time as a text. + */ +Datum +timeofday(PG_FUNCTION_ARGS) +{ + struct timeval tp; + char templ[128]; + char buf[128]; + pg_time_t tt; + + gettimeofday(&tp, NULL); + tt = (pg_time_t) tp.tv_sec; + pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z", + pg_localtime(&tt, session_timezone)); + snprintf(buf, sizeof(buf), templ, tp.tv_usec); + + PG_RETURN_TEXT_P(cstring_to_text(buf)); +} + +/* * TimestampDifference -- convert the difference between two timestamps * into integer seconds and microseconds * |