- Notifications
You must be signed in to change notification settings - Fork5
Commit519b075
committed
Use GetSystemTimeAsFileTime directly in win32
PostgreSQL was calling GetSystemTime followed by SystemTimeToFileTime in thewin32 port gettimeofday function. This is not necessary and limits the reportedprecision to the 1ms granularity that the SYSTEMTIME struct can represent. Byusing GetSystemTimeAsFileTime we avoid unnecessary conversions and capturetimestamps at 100ns granularity, which is then rounded to 1µs granularity forstorage in a PostgreSQL timestamp.On most Windows systems this change will actually have no significant effect ontimestamp resolution as the system timer tick is typically between 1ms and 15msdepending on what timer resolution currently running applications haverequested. You can check this with clockres.exe from sysinternals. Despite theplatform limiation this change still permits capture of finer timestamps wherethe system is capable of producing them and it gets rid of an unnecessarysyscall.The higher resolution GetSystemTimePreciseAsFileTime call available on Windows8 and Windows Server 2012 has the same interface as GetSystemTimeAsFileTime, soswitching to GetSystemTimeAsFileTime makes it easier to use the Precise variantlater.Craig Ringer, reviewed by David Rowley1 parent611d46e commit519b075
1 file changed
+12
-6
lines changedLines changed: 12 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
| 34 | + | |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 |
| |
38 | 45 |
| |
39 | 46 |
| |
| |||
44 | 51 |
| |
45 | 52 |
| |
46 | 53 |
| |
47 |
| - | |
48 | 54 |
| |
49 | 55 |
| |
50 |
| - | |
51 |
| - | |
| 56 | + | |
52 | 57 |
| |
53 | 58 |
| |
54 | 59 |
| |
55 |
| - | |
56 |
| - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
57 | 63 |
| |
58 | 64 |
| |
59 | 65 |
|
0 commit comments
Comments
(0)