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

Side by Side Diff: runtime/vm/os.h

Issue 10354011: Revert "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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/date.cc ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OS_H_ 5 #ifndef VM_OS_H_
6 #define VM_OS_H_ 6 #define VM_OS_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 9
10 // Forward declarations.
11 class tm;
12
13 namespace dart { 10 namespace dart {
14 11
15 // Forward declarations. 12 // Forward declarations.
16 class Isolate; 13 class Isolate;
17 14
18 // Interface to the underlying OS platform. 15 // Interface to the underlying OS platform.
19 class OS { 16 class OS {
20 public: 17 public:
18 typedef struct BrokenDownDate {
19 int year; // Offset by 1900. A value of 111 Represents the year 2011.
20 int month; // [0..11]
21 int day; // [1..31]
22 int hours;
23 int minutes;
24 int seconds;
25 } BrokenDownDate;
26
21 // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it 27 // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it
22 // down into date and time in the UTC timezone. 28 // down into date and time.
29 // If 'inUtc', then the broken down date and time are in the UTC timezone,
30 // otherwise the local timezone is used.
23 // The returned year is offset by 1900. The returned month is 0-based. 31 // The returned year is offset by 1900. The returned month is 0-based.
24 // Returns true if the conversion succeeds, false otherwise. 32 // Returns true if the conversion succeeds, false otherwise.
25 static bool GmTime(int64_t seconds_since_epoch, tm* tm_result); 33 static bool BreakDownSecondsSinceEpoch(time_t seconds_since_epoch,
34 bool in_utc,
35 BrokenDownDate* result);
26 36
27 // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it 37 // Converts a broken down date into the seconds since epoch (midnight,
28 // down into date and time in the local time. 38 // January 1, 1970 UTC). Returns true if the conversion succeeds, false
29 // The returned year is offset by 1900. The returned month is 0-based. 39 // otherwise.
30 // Returns true if the conversion succeeds, false otherwise. 40 static bool BrokenDownToSecondsSinceEpoch(
31 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result); 41 const BrokenDownDate& broken_down, bool in_utc, time_t* result);
32
33 // Takes the broken down date and time in UTC timezone and computes the
34 // seconds since epoch (midnight, January 1, 1970 UTC).
35 // The given year is offset by 1900. The given month is 0-based.
36 // Returns true if the conversion succeeds, false otherwise.
37 static bool MkGmTime(tm* tm, int64_t* seconds_result);
38
39 // Takes the broken down date and time in local timezone and computes the
40 // seconds since epoch (midnight, January 1, 1970 UTC).
41 // The given year is offset by 1900. The given month is 0-based.
42 // Returns true if the conversion succeeds, false otherwise.
43 static bool MkTime(tm* tm, int64_t* seconds_result);
44 42
45 // Returns the current time in milliseconds measured 43 // Returns the current time in milliseconds measured
46 // from midnight January 1, 1970 UTC. 44 // from midnight January 1, 1970 UTC.
47 static int64_t GetCurrentTimeMillis(); 45 static int64_t GetCurrentTimeMillis();
48 46
49 // Returns the current time in microseconds measured 47 // Returns the current time in microseconds measured
50 // from midnight January 1, 1970 UTC. 48 // from midnight January 1, 1970 UTC.
51 static int64_t GetCurrentTimeMicros(); 49 static int64_t GetCurrentTimeMicros();
52 50
53 // Returns the activation frame alignment constraint or zero if 51 // Returns the activation frame alignment constraint or zero if
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 static void Shutdown(); 95 static void Shutdown();
98 96
99 static void Abort(); 97 static void Abort();
100 98
101 static void Exit(int code); 99 static void Exit(int code);
102 }; 100 };
103 101
104 } // namespace dart 102 } // namespace dart
105 103
106 #endif // VM_OS_H_ 104 #endif // VM_OS_H_
OLDNEW
« 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