Skip to content

Commit 5933d52

Browse files
author
itagaki.takahiro
committed
Determine whether Daylight Saving Time is in effect when parse time.
git-svn-id: http://pg-rman.googlecode.com/svn/trunk@34 182aca00-e38e-11de-a668-6fd11605f5ce
1 parent 397c9eb commit 5933d52

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pgut/pgut.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ parse_time(const char *value, time_t *time)
497497
tmp[len] = '\0';
498498

499499
/* parse for "YYYY-MM-DD HH:MI:SS" */
500+
memset(&tm, 0, sizeof(tm));
500501
tm.tm_year = 0; /* tm_year is year - 1900 */
501502
tm.tm_mon = 0; /* tm_mon is 0 - 11 */
502503
tm.tm_mday = 1; /* tm_mday is 1 - 31 */
@@ -521,6 +522,9 @@ parse_time(const char *value, time_t *time)
521522
if (i > 1)
522523
tm.tm_mon -= 1;
523524

525+
/* determine whether Daylight Saving Time is in effect */
526+
tm.tm_isdst = -1;
527+
524528
*time = mktime(&tm);
525529

526530
return true;

0 commit comments

Comments
 (0)