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

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

Issue 10534111: Revert "Refactor Date implementation in VM." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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/vm/bootstrap_natives.h ('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. 10 // Forward declarations.
11 class tm; 11 class tm;
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 class Isolate; 16 class Isolate;
17 17
18 // Interface to the underlying OS platform. 18 // Interface to the underlying OS platform.
19 class OS { 19 class OS {
20 public: 20 public:
21 // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it
22 // down into date and time in the UTC timezone.
23 // The returned year is offset by 1900. The returned month is 0-based.
24 // Returns true if the conversion succeeds, false otherwise.
25 static bool GmTime(int64_t seconds_since_epoch, tm* tm_result);
26
27 // Takes the seconds since epoch (midnight, January 1, 1970 UTC) and breaks it
28 // down into date and time in the local time.
29 // The returned year is offset by 1900. The returned month is 0-based.
30 // Returns true if the conversion succeeds, false otherwise.
31 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_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
21 // Returns the abbreviated time-zone name for the given instant. 45 // Returns the abbreviated time-zone name for the given instant.
22 // For example "CET" or "CEST". 46 // For example "CET" or "CEST".
23 static const char* GetTimeZoneName(int64_t seconds_since_epoch); 47 static bool GetTimeZoneName(int64_t seconds_since_epoch,
48 const char** name_result);
24 49
25 // Returns the difference in seconds between local time and UTC for the given 50 // Returns the difference in seconds between local time and UTC for the given
26 // instant. 51 // instant.
27 // For example 3600 for CET, and 7200 for CEST. 52 // For example 3600 for CET, and 7200 for CEST.
28 static int GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch); 53 static bool GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch,
29 54 int* offset_result);
30 // Returns the difference in seconds between local time and UTC when no
31 // daylight saving is active.
32 // For example 3600 in CET and CEST.
33 static int GetLocalTimeZoneAdjustmentInSeconds();
34 55
35 // Returns the current time in milliseconds measured 56 // Returns the current time in milliseconds measured
36 // from midnight January 1, 1970 UTC. 57 // from midnight January 1, 1970 UTC.
37 static int64_t GetCurrentTimeMillis(); 58 static int64_t GetCurrentTimeMillis();
38 59
39 // Returns the current time in microseconds measured 60 // Returns the current time in microseconds measured
40 // from midnight January 1, 1970 UTC. 61 // from midnight January 1, 1970 UTC.
41 static int64_t GetCurrentTimeMicros(); 62 static int64_t GetCurrentTimeMicros();
42 63
43 // Returns the activation frame alignment constraint or zero if 64 // Returns the activation frame alignment constraint or zero if
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static void Shutdown(); 108 static void Shutdown();
88 109
89 static void Abort(); 110 static void Abort();
90 111
91 static void Exit(int code); 112 static void Exit(int code);
92 }; 113 };
93 114
94 } // namespace dart 115 } // namespace dart
95 116
96 #endif // VM_OS_H_ 117 #endif // VM_OS_H_
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698