Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
Needs more info comment that > 10 days [ID: 963198]
Comment such as: SPAM, non-actionable [ID: 963127]
Resolved actionable follow-up comments [ID: 963027]
View issue level access limits(Press Alt + Right arrow for more information)
Request for new functionality
View staffing
Description
-----------------------
I am following the link from here
Current Google Time Zone API spec (
1)
Please make timestamp optional, if the timestamp is not set, then Google Time Zone API assumes timestamp to be epoch time at the time of the request and constructs response accordingly.
Reason A)
I would like to use API to get current offsets for a location. Kind of which this API is for, right. :) However the client (say - it is fetch from an app written in JavaScript) that does the request cannot be trusted to provide correct current UTC (say - "new Date()") thus parameter "timestamp" may be incorrect thus your API return may be incorrect.
Reason B)
In order to make client able to send correct current timestamp to Time Zone API, I would need to first request current UTC from another non-Google time server API which makes possible to calculate delta between client's UTC and "correct UTC", which then would allow me to send correct current timestamp parameter to Google Time Zone API by constructing timestamp from clients UTC plus saved delta on each request.
It seems strange - in order to be able to use Google Time Zone API to get offests for "now" other time API has to be used.
2)
Would you consider Google Time Zone API endpoint to respond with current UTC also (so that delta can be calculated and saved on client using this API not another one)?
Example A)
When
{
"dstOffset": 0,
"rawOffset": 0,
"status": "OK",
"timeZoneId": "Etc/UTC",
"timeZoneName": "UTC (Coordinated Universal Time)"
"timestampRequested": 1581075282 <-- this extra value is added to request and is set to UTC for the time of the request (as no param was specified, requested time == current UTC)
}
Such request can be used to set client to correct time using timestampRequested value (the "delta approach" as mentioned above).
When
{
"dstOffset": 3600,
"rawOffset": -28800,
"status": "OK",
"timeZoneId": "America/Los_Angeles",
"timeZoneName": "Pacific Daylight Time"
"timestampRequested": 1458000000 <-- this extra value is added to request and is set to timestamp that the request was made for
}
Example B)
Similar to example A but with extra key, which allows to get current correct UTC on any request
yields
{
"dstOffset": 0,
"rawOffset": 0,
"status": "OK",
"timeZoneId": "Etc/UTC",
"timeZoneName": "UTC (Coordinated Universal Time)"
"timestampRequested": 1581075282 <-- this extra value is added to request and is set to UTC for the time of the request (as no param was specified, requested time == current UTC)
"timestampUtc": 1581075282 <-- this extra value is added to request and is set to UTC for the time of the request
}
yields
{
"dstOffset": 3600,
"rawOffset": -28800,
"status": "OK",
"timeZoneId": "America/Los_Angeles",
"timeZoneName": "Pacific Daylight Time"
"timestampRequested": 1458000000 <-- this extra value is added to request and is set to timestamp that the request was made for
"timestampUtc": 1581075282 <-- this extra value is added to request and is set to UTC for the time of the request
}
thus client get the benefit of being able to set delta on any request to API (a nice sideffect).
Thanks.