From nobody  Mon Oct  5 03:22:54 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id DAA16177;
          Mon, 5 Oct 1998 03:22:54 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199810051022.DAA16177@hub.freebsd.org>
Date: Mon, 5 Oct 1998 03:22:54 -0700 (PDT)
From: estartu@augusta.de
To: freebsd-gnats-submit@freebsd.org
Subject: mktime does not set tm_wday
X-Send-Pr-Version: www-1.0

>Number:         8156
>Category:       misc
>Synopsis:       mktime does not set tm_wday
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct  5 03:30:00 PDT 1998
>Closed-Date:    Tue Oct 6 07:47:15 PDT 1998
>Last-Modified:  Tue Oct  6 07:50:29 PDT 1998
>Originator:     Gerhard Schmidt
>Release:        2.2.7-stable
>Organization:
Augsburger Computer Forum e.V.
>Environment:
FreeBSD inga.augusta.de 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Thu Sep 17 15:22:59 MET DST 1998     root@inga.augusta.de:/usr/src/sys/compile/INGA  i386

>Description:
I have to finde out the weeekday of a spezific date and tryed to do
this using mktime. As Said in the Manpage tm_wday is set to the weekday
the programm fills the struct tm with the date and calles mktime 
but after return tm_wday hasn't change. 
>How-To-Repeat:
struct tm Z
Z->tm_mday = 1;
Z->tm_mon = 1;
Z->tm_year = 1999;
Z->tm_isdst = -1;
mktime(&Z);

>Fix:

>Release-Note:
>Audit-Trail:

From: Q <q@fan.net.au>
To: estartu@augusta.de
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/8156: mktime does not set tm_wday
Date: Mon, 5 Oct 1998 23:49:48 +1000 (EST)

 On Mon, 5 Oct 1998 estartu@augusta.de wrote:
 
 > >Originator:     Gerhard Schmidt
 > >Organization:
 > Augsburger Computer Forum e.V.
 > >Release:        2.2.7-stable
 > >Environment:
 > FreeBSD inga.augusta.de 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Thu Sep 17 15:22:59 MET DST 1998     root@inga.augusta.de:/usr/src/sys/compile/INGA  i386
 > 
 > >Description:
 > I have to finde out the weeekday of a spezific date and tryed to do
 > this using mktime. As Said in the Manpage tm_wday is set to the weekday
 > the programm fills the struct tm with the date and calles mktime 
 > but after return tm_wday hasn't change. 
 > >How-To-Repeat:
 > struct tm Z
 > Z->tm_mday = 1;
 > Z->tm_mon = 1;
 > Z->tm_year = 1999;
 > Z->tm_isdst = -1;
 > mktime(&Z);
 > 
 > >Fix:
 
 From mktime() man page:
 
 External declarations as well as the tm structure definition are in the
 <time.h> include file.  The tm structure includes at least the
 following fields:
 
            int tm_sec;     /* seconds (0 - 60) */
            int tm_min;     /* minutes (0 - 59) */
            int tm_hour;    /* hours (0 - 23) */
            int tm_mday;    /* day of month (1 - 31) */
            int tm_mon;     /* month of year (0 - 11) */
            int tm_year;    /* year - 1900 */
                               ^^^^^^^^^^^
 
 It's not a bug. Your using the struct incorrectly. Every call you make to
 mktime() will be returning -1. You are effectively asking it for the year
 3899. Which can't be expresses using a time_t value. Change 'tm_year =
 1999' to 'tm_year = 99'. You should put your Y2K hat on if you plan to use
 a 'struct tm' in your application.
 
 Seeya...Q
 
                -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                         
                           _____  /      Quinton Dolan - q@fan.net.au
   __  __/  /   /   __/   /      /          Systems Administrator
      /    __  /   _/    /      /            Fast Access Network
   __/  __/ __/ ____/   /   -  /          Gold Coast, QLD, Australia
                     _______  /              Ph: +61 7 5574 1050
                            \_\                 SAGE-AU Member
 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Tue Oct 6 07:47:15 PDT 1998 
State-Changed-Why:  
Pilot error. 
>Unformatted:
