File tree Expand file tree Collapse file tree 2 files changed +20
-29
lines changed Expand file tree Collapse file tree 2 files changed +20
-29
lines changed Original file line number Diff line number Diff line change @@ -1539,32 +1539,3 @@ parsetinterval(char *i_string,
15391539 "tinterval" , i_string )));
15401540 * i_start = * i_end = INVALID_ABSTIME ; /* keep compiler quiet */
15411541}
1542-
1543-
1544- /*****************************************************************************
1545- *
1546- *****************************************************************************/
1547-
1548- /*
1549- * timeofday -
1550- * returns the current time as a text. similar to timenow() but returns
1551- * seconds with more precision (up to microsecs). (I need this to compare
1552- * the Wisconsin benchmark with Illustra whose TimeNow() shows current
1553- * time with precision up to microsecs.) - ay 3/95
1554- */
1555- Datum
1556- timeofday (PG_FUNCTION_ARGS )
1557- {
1558- struct timeval tp ;
1559- char templ [128 ];
1560- char buf [128 ];
1561- pg_time_t tt ;
1562-
1563- gettimeofday (& tp , NULL );
1564- tt = (pg_time_t ) tp .tv_sec ;
1565- pg_strftime (templ , sizeof (templ ), "%a %b %d %H:%M:%S.%%06d %Y %Z" ,
1566- pg_localtime (& tt , session_timezone ));
1567- snprintf (buf , sizeof (buf ), templ , tp .tv_usec );
1568-
1569- PG_RETURN_TEXT_P (cstring_to_text (buf ));
1570- }
Original file line number Diff line number Diff line change @@ -1609,6 +1609,26 @@ GetSQLLocalTimestamp(int32 typmod)
16091609 return ts ;
16101610}
16111611
1612+ /*
1613+ * timeofday(*) -- returns the current time as a text.
1614+ */
1615+ Datum
1616+ timeofday (PG_FUNCTION_ARGS )
1617+ {
1618+ struct timeval tp ;
1619+ char templ [128 ];
1620+ char buf [128 ];
1621+ pg_time_t tt ;
1622+
1623+ gettimeofday (& tp , NULL );
1624+ tt = (pg_time_t ) tp .tv_sec ;
1625+ pg_strftime (templ , sizeof (templ ), "%a %b %d %H:%M:%S.%%06d %Y %Z" ,
1626+ pg_localtime (& tt , session_timezone ));
1627+ snprintf (buf , sizeof (buf ), templ , tp .tv_usec );
1628+
1629+ PG_RETURN_TEXT_P (cstring_to_text (buf ));
1630+ }
1631+
16121632/*
16131633 * TimestampDifference -- convert the difference between two timestamps
16141634 * into integer seconds and microseconds
You can’t perform that action at this time.
0 commit comments