Skip to content

Commit

Permalink
8288378: [BACKOUT] DST not applying properly with zone id offset set …
Browse files Browse the repository at this point in the history
…with TZ env variable

Reviewed-by: dholmes
  • Loading branch information
naotoj committed Jun 14, 2022
1 parent 1904353 commit fbe9266
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 94 deletions.
21 changes: 4 additions & 17 deletions src/java.base/unix/native/libjava/TimeZone_md.c
Expand Up @@ -592,31 +592,18 @@ getGMTOffsetID()
{
time_t offset;
char sign, buf[32];
struct tm localtm;
time_t clock;

clock = time(NULL);
if (localtime_r(&clock, &localtm) == NULL) {
return strdup("GMT");
}

struct tm gmt;

if (gmtime_r(&clock, &gmt) == NULL) {
return strdup("GMT");
}

offset = (localtm.tm_hour - gmt.tm_hour)*3600 + (localtm.tm_min - gmt.tm_min)*60;
offset = timezone;

if (offset == 0) {
return strdup("GMT");
}

/* Note that the time offset direction is opposite. */
if (offset > 0) {
sign = '+';
sign = '-';
} else {
offset = -offset;
sign = '-';
sign = '+';
}
sprintf(buf, (const char *)"GMT%c%02d:%02d",
sign, (int)(offset/3600), (int)((offset%3600)/60));
Expand Down
77 changes: 0 additions & 77 deletions test/jdk/java/util/TimeZone/CustomTzIDCheckDST.java

This file was deleted.

1 comment on commit fbe9266

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.