forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0703814
committed
From: "D'Arcy J.M. Cain" <darcy@druid.net>
Subject: [HACKERS] backend/utils/adt/timestamp.cBack to this timezone stuff. The struct tm has a field (tm_gmtoff) whichis the offset from UTC (GMT is archaic BTW) in seconds. Is this thevalue you are looking for when you use timezone? Note that this appliesto NetBSD but it does not appear to be in either ANSI C or POSIX. Thislooks like one of those things that is just going to have to be handcoded for each platform.Why not just store the values in UTC and use localtime instead ofgmtime when retrieving the value?Also, you assume the time is returned as a 4 byte integer. In fact,there is not even any requirement that time be an integral value. Youshould use time_t here.The input function seems unduly restrictive. Somewhere in the sourcesthere is an input function that allows words for months. Can't we dothe same here?There is a standard function, difftime, for subtracting two times. Itdeals with cases where time_t is not integral. There is, however, asmall performance hit since it returns a double and I don't believethere is any system currently which uses anything but an integral fortime_t. Still, this is technically the correct and portable thing to do.The returns from the various comparisons should probably be a bool.1 parentc2e73db commit0703814
2 files changed
+34
-42
lines changedLines changed: 24 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 |
| - | |
8 |
| - | |
| 7 | + | |
| 8 | + | |
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
29 | 28 |
| |
30 | 29 |
| |
31 | 30 |
| |
32 | 31 |
| |
33 | 32 |
| |
34 |
| - | |
| 33 | + | |
35 | 34 |
| |
36 | 35 |
| |
37 | 36 |
| |
38 | 37 |
| |
39 |
| - | |
| 38 | + | |
40 | 39 |
| |
41 | 40 |
| |
42 | 41 |
| |
| |||
45 | 44 |
| |
46 | 45 |
| |
47 | 46 |
| |
48 |
| - | |
| 47 | + | |
49 | 48 |
| |
50 | 49 |
| |
51 |
| - | |
52 | 50 |
| |
53 | 51 |
| |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 | 52 |
| |
60 |
| - | |
61 |
| - | |
| 53 | + | |
62 | 54 |
| |
63 | 55 |
| |
64 |
| - | |
65 |
| - | |
| 56 | + | |
| 57 | + | |
66 | 58 |
| |
67 |
| - | |
| 59 | + | |
68 | 60 |
| |
69 | 61 |
| |
70 |
| - | |
71 |
| - | |
| 62 | + | |
| 63 | + | |
72 | 64 |
| |
73 |
| - | |
| 65 | + | |
74 | 66 |
| |
75 | 67 |
| |
76 |
| - | |
77 |
| - | |
| 68 | + | |
| 69 | + | |
78 | 70 |
| |
79 |
| - | |
| 71 | + | |
80 | 72 |
| |
81 | 73 |
| |
82 |
| - | |
83 |
| - | |
| 74 | + | |
| 75 | + | |
84 | 76 |
| |
85 |
| - | |
| 77 | + | |
86 | 78 |
| |
87 | 79 |
| |
88 |
| - | |
89 |
| - | |
| 80 | + | |
| 81 | + | |
90 | 82 |
| |
91 |
| - | |
| 83 | + | |
92 | 84 |
| |
93 | 85 |
| |
94 |
| - | |
95 |
| - | |
| 86 | + | |
| 87 | + | |
96 | 88 |
| |
97 |
| - | |
| 89 | + | |
98 | 90 |
|
Lines changed: 10 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| |||
407 | 407 |
| |
408 | 408 |
| |
409 | 409 |
| |
410 |
| - | |
411 |
| - | |
412 |
| - | |
413 |
| - | |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
419 | 419 |
| |
420 | 420 |
| |
421 | 421 |
| |
|
0 commit comments
Comments
(0)