Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions php/ext/google/protobuf/upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14288,7 +14288,7 @@ static void start_timestamp_zone(upb_json_parser *p, const char *ptr) {
static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
size_t len;
const char *buf;
int hours;
int hours = 0;
int64_t seconds;
const char *seconds_membername = "seconds";

Expand All @@ -14308,12 +14308,11 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
if (buf[0] == '+') {
hours = -hours;
}

p->tm.tm_hour += hours;
}

/* Normalize tm */
seconds = mktime(&p->tm);
seconds = mktime(&p->tm) - timezone;
seconds += 3600 * hours;

/* Check timestamp boundary */
if (seconds < -62135596800) {
Expand Down
2 changes: 1 addition & 1 deletion ruby/ext/google/protobuf_c/upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14311,7 +14311,7 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
}

/* Normalize tm */
seconds = timegm(&p->tm);
seconds = mktime(&p->tm) - timezone;
Copy link

Choose a reason for hiding this comment

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

This does not work on *BSD platforms where timezone is not a long int variable but a function.

Is this change due to timegm() not available everywhere?

seconds += 3600 * hours;

/* Check timestamp boundary */
Expand Down