MCPcopy Create free account
hub / github.com/apache/cloudberry / GetCurrentTimestamp

Function GetCurrentTimestamp

src/backend/utils/adt/timestamp.c:1932–1945  ·  view source on GitHub ↗

* GetCurrentTimestamp -- get the current operating system time * * Result is in the form of a TimestampTz value, and is expressed to the * full precision of the gettimeofday() syscall */

Source from the content-addressed store, hash-verified

1930 * full precision of the gettimeofday() syscall
1931 */
1932TimestampTz
1933GetCurrentTimestamp(void)
1934{
1935 TimestampTz result;
1936 struct timeval tp;
1937
1938 gettimeofday(&tp, NULL);
1939
1940 result = (TimestampTz) tp.tv_sec -
1941 ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY);
1942 result = (result * USECS_PER_SEC) + tp.tv_usec;
1943
1944 return result;
1945}
1946
1947/*
1948 * GetSQLCurrentTimestamp -- implements CURRENT_TIMESTAMP, CURRENT_TIMESTAMP(n)

Callers 15

pgfdw_cancel_queryFunction · 0.85
pgfdw_exec_cleanup_queryFunction · 0.85
pgfdw_get_cleanup_resultFunction · 0.85
autoprewarm_mainFunction · 0.85
pgss_shmem_startupFunction · 0.85
entry_resetFunction · 0.85
check_log_durationFunction · 0.85
PostgresMainFunction · 0.85
log_disconnectionsFunction · 0.85
InitPostgresFunction · 0.85
pgstat_report_activityFunction · 0.85
handle_sig_alarmFunction · 0.85

Calls 1

gettimeofdayFunction · 0.85

Tested by 4

test_patternFunction · 0.68
test_XLogWalRcvSendReplyFunction · 0.68