[issue13309] test_time fails: time data 'LMT' does not match format '%Z'

Ross Lagerwall report at bugs.python.org
Tue Nov 1 17:45:49 CET 2011


Ross Lagerwall <rosslagerwall at gmail.com> added the comment:

It outputs:
SAST
LMT
LMT

An equivalent C program to the first test:
"""
#include <time.h>
#include <stdlib.h>
#include <stdio.h>

int main() {

    time_t t;
    struct tm *tmp;

    t = time(NULL);
    tmp = localtime(&t);

    char str[200];
    strftime(str, sizeof(str), "%Z", tmp);

    puts(str);

    struct tm tmp2;
    tmp2.tm_sec = 0;
    tmp2.tm_min = 0;
    tmp2.tm_hour = 0;
    tmp2.tm_mday = 1;
    tmp2.tm_mon = 1;
    tmp2.tm_year = -1;
    tmp2.tm_wday = -1;
    tmp2.tm_yday = -1;
    tmp2.tm_isdst = -1;
    mktime(&tmp2);

    t = time(NULL);
    tmp = localtime(&t);

    strftime(str, sizeof(str), "%Z", tmp);

    puts(str);

    return 0;
}
"""

Outputs (as expected):
SAST
SAST

Perhaps it's not mktime?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13309>
_______________________________________


More information about the Python-bugs-list mailing list