Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: runtime/vm/os_macos.cc

Issue 10413031: Reapply "Add support for timezone offset and timezone name." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_linux.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_macos.cc
diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc
index d602485892e546c89b04c9053d7ac9ad6f208b85..3936e99e93ea46546e6623ca1749ec72d25977cc 100644
--- a/runtime/vm/os_macos.cc
+++ b/runtime/vm/os_macos.cc
@@ -60,6 +60,27 @@ bool OS::MkTime(tm* tm, int64_t* seconds_result) {
}
+bool OS::GetTimeZoneName(int64_t seconds_since_epoch,
+ const char** name_result) {
+ tm decomposed;
+ bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
+ if (!succeeded) return false;
+ *name_result = decomposed.tm_zone;
+ return true;
+}
+
+
+bool OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch,
+ int* offset_result) {
+ tm decomposed;
+ bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
+ if (!succeeded) return false;
+ // Even if the offset was 24 hours it would still easily fit into 32 bits.
+ *offset_result = static_cast<int>(decomposed.tm_gmtoff);
+ return true;
+}
+
+
int64_t OS::GetCurrentTimeMillis() {
return GetCurrentTimeMicros() / 1000;
}
« no previous file with comments | « runtime/vm/os_linux.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698