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

Unified Diff: runtime/vm/os.h

Issue 9969098: Set the TZ env to get the UTC-ms since epoch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 8 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/lib/date.cc ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os.h
diff --git a/runtime/vm/os.h b/runtime/vm/os.h
index 022d21e0108d84d70ad9f65936169c3369aecb14..2c0fbb93cc704e202c85b489be3a7dc94ef469bb 100644
--- a/runtime/vm/os.h
+++ b/runtime/vm/os.h
@@ -7,6 +7,9 @@
#include "vm/globals.h"
+// Forward declarations.
+class tm;
+
namespace dart {
// Forward declarations.
@@ -15,30 +18,29 @@ class Isolate;
// Interface to the underlying OS platform.
class OS {
public:
- typedef struct BrokenDownDate {
- int year; // Offset by 1900. A value of 111 Represents the year 2011.
- int month; // [0..11]
- int day; // [1..31]
- int hours;
- int minutes;
- int seconds;
- } BrokenDownDate;
+ // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it
+ // down into date and time in the UTC timezone.
+ // The returned year is offset by 1900. The returned month is 0-based.
+ // Returns true if the conversion succeeds, false otherwise.
+ static bool GmTime(int64_t seconds_since_epoch, tm* tm_result);
// Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it
- // down into date and time.
- // If 'inUtc', then the broken down date and time are in the UTC timezone,
- // otherwise the local timezone is used.
+ // down into date and time in the local time.
// The returned year is offset by 1900. The returned month is 0-based.
// Returns true if the conversion succeeds, false otherwise.
- static bool BreakDownSecondsSinceEpoch(time_t seconds_since_epoch,
- bool in_utc,
- BrokenDownDate* result);
-
- // Converts a broken down date into the seconds since epoch (midnight,
- // January 1, 1970 UTC). Returns true if the conversion succeeds, false
- // otherwise.
- static bool BrokenDownToSecondsSinceEpoch(
- const BrokenDownDate& broken_down, bool in_utc, time_t* result);
+ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result);
+
+ // Takes the broken down date and time in UTC timezone and computes the
+ // seconds since epoch (midnight, January 1, 1970 UTC).
+ // The given year is offset by 1900. The given month is 0-based.
+ // Returns true if the conversion succeeds, false otherwise.
+ static bool MkGmTime(tm* tm, int64_t* seconds_result);
+
+ // Takes the broken down date and time in local timezone and computes the
+ // seconds since epoch (midnight, January 1, 1970 UTC).
+ // The given year is offset by 1900. The given month is 0-based.
+ // Returns true if the conversion succeeds, false otherwise.
+ static bool MkTime(tm* tm, int64_t* seconds_result);
// Returns the current time in milliseconds measured
// from midnight January 1, 1970 UTC.
« no previous file with comments | « runtime/lib/date.cc ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698