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

Side by Side Diff: chrome/browser/sync/notifier/base/time.h

Issue 1956001: Moved XMPP notifier library from chrome/browser/sync to chrome/common.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_BASE_TIME_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_BASE_TIME_H_
7
8 #include <time.h>
9
10 #include "talk/base/basictypes.h"
11
12 typedef uint64 time64;
13
14 #define kMicrosecsTo100ns (static_cast<time64>(10))
15 #define kMillisecsTo100ns (static_cast<time64>(10000))
16 #define kSecsTo100ns (1000 * kMillisecsTo100ns)
17 #define kMinsTo100ns (60 * kSecsTo100ns)
18 #define kHoursTo100ns (60 * kMinsTo100ns)
19 #define kDaysTo100ns (24 * kHoursTo100ns)
20 const time64 kMaxTime100ns = UINT64_C(9223372036854775807);
21
22 // Time difference in 100NS granularity between platform-dependent starting
23 // time and Jan 1, 1970.
24 #if defined(OS_WIN)
25 // On Windows time64 is seconds since Jan 1, 1601.
26 #define kStart100NsTimeToEpoch (116444736000000000uI64)
27 #else
28 // On Unix time64 is seconds since Jan 1, 1970.
29 #define kStart100NsTimeToEpoch (0)
30 #endif
31
32 // Time difference in 100NS granularity between platform-dependent starting
33 // time and Jan 1, 1980.
34 #define kStart100NsTimeTo1980 \
35 kStart100NsTimeToEpoch + UINT64_C(3155328000000000)
36
37 #define kTimeGranularity (kDaysTo100ns)
38
39 namespace notifier {
40
41 // Get the current time represented in 100NS granularity. Different platform
42 // might return the value since different starting time. Win32 platform returns
43 // the value since Jan 1, 1601.
44 time64 GetCurrent100NSTime();
45
46 // Convert from struct tm to time64.
47 time64 TmToTime64(const struct tm& tm);
48
49 // Convert from time64 to struct tm.
50 bool Time64ToTm(time64 t, struct tm* tm);
51
52 // Returns the local time as a string suitable for logging.
53 // Note: This is *not* threadsafe, so only call it from the main thread.
54 char* GetLocalTimeAsString();
55
56 } // namespace notifier
57
58 #endif // CHROME_BROWSER_SYNC_NOTIFIER_BASE_TIME_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/base/task_pump.cc ('k') | chrome/browser/sync/notifier/base/time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698