* 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 */
| 1930 | * full precision of the gettimeofday() syscall |
| 1931 | */ |
| 1932 | TimestampTz |
| 1933 | GetCurrentTimestamp(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) |