strptime loses one hour if TZ set to Dublin
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
glibc version 2.28-0ubuntu1
If timezone is set to Dublin, strptime returns one hour less than it should. Timezone set to London works fine, but Dublin and London are in the same time zone. DST is not active.
mark@sotera:
t(orig)=1551972563
s=2019-
calling strptime
t(new)=1551968963
s=2019-
mark@sotera:
t(orig)=1551972570
s=2019-
calling strptime
t(new)=1551972570
s=2019-
where test.c is the following:
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <time.h>
int main (void)
{
struct tm tms;
time_t t;
char s[100];
int sec;
t = time (NULL);
printf ("t(orig)=%d\n", (int) t);
gmtime_r (&t, &tms);
strftime (s, 90, "%Y-%m-
printf ("s=%s\n", s);
memset (&tms, 0, sizeof (struct tm));
printf("calling strptime\n");
char *unproc = strptime (s, "%Y-%m-
t = mktime(&tms);
printf ("t(new)=%d\n", (int) t);
gmtime_r (&t, &tms);
strftime (s, 90, "%Y-%m-
printf ("s=%s\n", s);
return 0;
}