mailing list of musl libc
 help / color / mirror / code / Atom feed
From: bfdamkoehler <bfdamkoehler@sbcglobal.net>
To: musl@lists.openwall.com
Subject: Re: REG_STARTEND (regex)
Date: Wed, 11 Jun 2014 21:00:00 -0400	[thread overview]
Message-ID: <5398FB90.7000109@sbcglobal.net> (raw)
In-Reply-To: <CAK4o1WyVzmgNypK8n1gQuBhxFL19KmBwXjynA+Kc+MgSz2qA5g@mail.gmail.com>


Hello,

I noticed an issue with localtime() in musl-1.1.2. In my environment TZ 
is set to EST5EDT. There is a test program below that demonstrates this. 
localtime() is returning with isdst == 1 for for a time_t value of 
1394327858 (08-Mar-14 20:17). Daylight savings time starts on 09-Mar-14. 
Note that if you decrement the time_t value in the test program isdst 
remains set.

This time_t value is the st_atime value of a file on my machine, as 
returned by stat64().

Just as further test I moved the file around to an AIX 5.2 machine, HPUX 
11.11, and OpenBSD 5.0 system and a Centos 6.5 linux machine. I used ls 
and tar on them to display the file date and they all came out as 
08-Mar-14 20:17, as does the output from my application if it is linked 
with the gcc libc. When my application is linked with musl it produces a 
time of 08-Mar-14 21:17.

I just wanted to mention that I had noticed this.

Bruce


#include                <stdio.h>
#include                <string.h>
#include                <stdlib.h>
#include                <time.h>

int main()
{
     time_t              bin_time = 1394327858;  /* should be 08-Mar-14 
20:17 but */
                                                 /* localtime returns 
isdst=1 so  */
                                                 /* it is 08-Mar-14 
21:17         */
     struct tm           *tm_ptr;
     char                *cptr;

//#define GO_BACK_N_DAYS_IN_TIME
#ifdef  GO_BACK_N_DAYS_IN_TIME
     bin_time = 1394327858 - ( (24 * 60 * 60) * 60);
#endif

     cptr = getenv("TZ");
     if( cptr == NULL )
         printf("the TZ environment variable is not defined\n");
     else
         printf("the TZ environment variable is set to %s\n", cptr);

     tm_ptr = localtime(&bin_time);
     printf("The local time is ...\n");
     printf("\t\ttm_sec ........... %d\n", tm_ptr->tm_sec);
     printf("\t\ttm_min ........... %d\n", tm_ptr->tm_min);
     printf("\t\ttm_hour .......... %d\n", tm_ptr->tm_hour);
     printf("\t\ttm_mday .......... %d\n", tm_ptr->tm_mday);
     printf("\t\ttm_mon ........... %d\n", tm_ptr->tm_mon);
     printf("\t\ttm_year .......... %d\n", tm_ptr->tm_year);
     printf("\t\ttm_wday .......... %d\n", tm_ptr->tm_wday);
     printf("\t\ttm_yday .......... %d\n", tm_ptr->tm_yday);
     printf("\t\ttm_is_dst......... %d\n", tm_ptr->tm_isdst);
     printf("\n\n");

     printf("tm_hour should be 20 and tm_is_dst should be 0 -- DST 
starts on 09-Mar-14.\n");
     printf("\n\n");

}




  reply	other threads:[~2014-06-12  1:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 10:34 Daniel Cegiełka
2013-01-15 13:42 ` Rich Felker
2013-01-15 15:16   ` Daniel Cegiełka
2013-01-15 15:37     ` John Spencer
2013-01-15 15:50       ` Daniel Cegiełka
2013-01-15 16:13         ` Rob Landley
2013-01-15 18:38         ` John Spencer
2013-01-16 15:41           ` Rob Landley
2013-01-15 16:11     ` Rob Landley
2013-01-15 18:45     ` Rich Felker
2013-01-15 18:55       ` Daniel Cegiełka
2013-01-16 15:42       ` Rob Landley
2013-01-16 16:57         ` Rich Felker
2014-06-11 14:24     ` Justin Cormack
2014-06-12  1:00       ` bfdamkoehler [this message]
2014-06-12  1:40         ` Rich Felker
2014-06-13  1:15           ` bfdamkoehler
2014-06-13  3:00             ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5398FB90.7000109@sbcglobal.net \
    --to=bfdamkoehler@sbcglobal.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).