> Steve:
> Same result, so it's not the TZ environmental variable.
>
> #include
> #include
> #include
> #include
>
> int main() {
>
> char pacific_timezone[8] = "PST8PDT";
> char * timezone =_timezone[0];
>
> // Date: November 18, 1883 12:07:01 am PST
>
> struct tm
> "logical" == logical american writes:
logical> That is the $64,000 question, I want to know why the gcc
logical> compiler changed the timezone to LMT on its own.
I'm guessing it's an artifact of glibc's mktime() implementation. I'd
suggest looking that the
> "Russell" == Russell Senior writes:
> "logical" == logical american writes:
logical> That is the $64,000 question, I want to know why the gcc
logical> compiler changed the timezone to LMT on its own.
Russell> I'm guessing it's an
It appears to be garbage in - garbage out, via a very obscure route.
If you start off with
TZ=PST8PDT
export TZ
call your program
then you get consistent results, with the tm_zone portion of the struct
set to PDT in both cases.
the man page for mktime doesn't indicate that the tm_gmtoff and
Steve:
Same result, so it's not the TZ environmental variable.
#include
#include
#include
#include
int main() {
char pacific_timezone[8] = "PST8PDT";
char * timezone =_timezone[0];
// Date: November 18, 1883 12:07:01 am PST
struct tm first_tm;
> galens@lion:~$ make mktime_test
> cc mktime_test.c -o mktime_test
> galens@lion:~$ ./mktime_test
> first struct tm object dump: 1 7 12 18 10 -17 0 321 0 -28378 LMT
> second struct tm object dump: 2 7 12 18 10 -17 0 321 0 -28800 PST
> First time tick: -2717640001 Second time tick:
On 1/26/2016 4:49 AM, David Barr wrote:
> I will quite happily play the straight man, here: why are `gmtoff` and `zone`
> different in `first_tm` vs `second_tm`?
>
> David
That is the $64,000 question, I want to know why the gcc compiler
changed the timezone to LMT on its own.
I will quite happily play the straight man, here: why are `gmtoff` and `zone`
different in `first_tm` vs `second_tm`?
David
> On Jan 25, 2016, at 20:57, Galen Seitz wrote:
>
> On 01/25/16 17:23, logical american wrote:
>> To C geeks:
>>
>> Could someone who has
On 01/25/16 20:57, Galen Seitz wrote:
> On 01/25/16 17:23, logical american wrote:
>> To C geeks:
>>
>> Could someone who has freetime on their linux system compile the
>> following C program and see if they can duplicate these results?
>> I found a strange 422 second difference between the 2
To C geeks:
Could someone who has freetime on their linux system compile the
following C program and see if they can duplicate these results?
I found a strange 422 second difference between the 2 times.
mktime-discrepancy.c
-
#include
#include
#include
10 matches
Mail list logo