Explicitly specify that availabilityStartTime is UTC

- Adding a 'Z' at the end means it is in UTC time.

Change-Id: I2e876c81449adcf3878e6d0d2b3c74f34edc8963
This commit is contained in:
Rintaro Kuroiwa 2015-09-10 11:53:53 -07:00
parent 0687b544b1
commit d6fea8a8e6
1 changed files with 3 additions and 2 deletions

View File

@ -101,14 +101,15 @@ bool Positive(double d) {
return d > 0.0; return d > 0.0;
} }
// Return current time in XML DateTime format. // Return current time in XML DateTime format. The value is in UTC, so the
// string ends with a 'Z'.
std::string XmlDateTimeNowWithOffset(int32_t offset_seconds) { std::string XmlDateTimeNowWithOffset(int32_t offset_seconds) {
base::Time time = base::Time::Now(); base::Time time = base::Time::Now();
time += base::TimeDelta::FromSeconds(offset_seconds); time += base::TimeDelta::FromSeconds(offset_seconds);
base::Time::Exploded time_exploded; base::Time::Exploded time_exploded;
time.UTCExplode(&time_exploded); time.UTCExplode(&time_exploded);
return base::StringPrintf("%4d-%02d-%02dT%02d:%02d:%02d", time_exploded.year, return base::StringPrintf("%4d-%02d-%02dT%02d:%02d:%02dZ", time_exploded.year,
time_exploded.month, time_exploded.day_of_month, time_exploded.month, time_exploded.day_of_month,
time_exploded.hour, time_exploded.minute, time_exploded.hour, time_exploded.minute,
time_exploded.second); time_exploded.second);