Date: Wed, 2 Oct 2002 09:50:26 -0700 (PDT) From: Ben Burke <ben@dubuque365.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/43592: mktime rejects dates at the start of daylight savings time Message-ID: <200210021650.g92GoQtZ047931@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 43592
>Category: bin
>Synopsis: mktime rejects dates at the start of daylight savings time
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 02 10:00:09 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Ben Burke
>Release: 4.6-STABLE
>Organization:
Iowa365
>Environment:
FreeBSD watchtower.office.parksmediagroup.com 4.6-STABLE FreeBSD 4.6-STABLE #0: Mon Sep 2 06:57:32 CDT 2002 root@mymachine:/usr/src/sys/compile/BEN.2002.09.02.R1 i386
>Description:
FreeBSD's mktime behavior for the "missing" hour at the start of daylight savings time is to return -1. Other OSes that I use and have tested compensate for this gap. The short program below shows the leap from 1 AM to -1 on FreeBSD, and from 1 AM to 3 AM on Linux or OSX.
>How-To-Repeat:
Compile the short C++ program below and run.
#include <iostream.h>
#include <time.h>
int main() {
struct tm date1;
date1.tm_sec = 0; /* seconds (0 - 60) */
date1.tm_min = 0; /* minutes (0 - 59) */
date1.tm_hour = 2; /* hours (0 - 23) */
date1.tm_mday = 4; /* day of month (1 - 31) */
date1.tm_mon = 3; /* month of year (0 - 11) */
date1.tm_year = 104; /* year - 1900 */
cout << mktime(&date1) << "\n";
/* An hour later */
struct tm date2;
date2.tm_sec = 0; /* seconds (0 - 60) */
date2.tm_min = 0; /* minutes (0 - 59) */
date2.tm_hour = 3; /* hours (0 - 23) */
date2.tm_mday = 4; /* day of month (1 - 31) */
date2.tm_mon = 3; /* month of year (0 - 11) */
date2.tm_year = 104; /* year - 1900 */
date1.tm_isdst = -1; /* year - 1900 */
cout << mktime(&date2) << "\n";
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210021650.g92GoQtZ047931>
