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

Side by Side Diff: lib/Support/Unix/TimeValue.inc

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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
« no previous file with comments | « lib/Support/Unix/Signals.inc ('k') | lib/Support/Unix/Watchdog.inc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- Unix/TimeValue.cpp - Unix TimeValue Implementation -------*- C++ -*-===// 1 //===- Unix/TimeValue.cpp - Unix TimeValue Implementation -------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the Unix specific portion of the TimeValue class. 10 // This file implements the Unix specific portion of the TimeValue class.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 //=== WARNING: Implementation here must contain only generic UNIX code that 15 //=== WARNING: Implementation here must contain only generic UNIX code that
16 //=== is guaranteed to work on *all* UNIX variants. 16 //=== is guaranteed to work on *all* UNIX variants.
17 //===----------------------------------------------------------------------===// 17 //===----------------------------------------------------------------------===//
18 18
19 #include "Unix.h" 19 #include "Unix.h"
20 20
21 // @LOCALMOD-START
22 #ifndef timerclear
23 // Newlib does not have the timer{clear,add,sub} macros
24 #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
25 #endif
26 // @LOCALMOD-END
27
21 namespace llvm { 28 namespace llvm {
22 using namespace sys; 29 using namespace sys;
23 30
24 std::string TimeValue::str() const { 31 std::string TimeValue::str() const {
25 time_t OurTime = time_t(this->toEpochTime()); 32 time_t OurTime = time_t(this->toEpochTime());
26 struct tm Storage; 33 struct tm Storage;
27 struct tm *LT = ::localtime_r(&OurTime, &Storage); 34 struct tm *LT = ::localtime_r(&OurTime, &Storage);
28 assert(LT); 35 assert(LT);
29 char Buffer1[sizeof("YYYY-MM-DD HH:MM:SS")]; 36 char Buffer1[sizeof("YYYY-MM-DD HH:MM:SS")];
30 strftime(Buffer1, sizeof(Buffer1), "%Y-%m-%d %H:%M:%S", LT); 37 strftime(Buffer1, sizeof(Buffer1), "%Y-%m-%d %H:%M:%S", LT);
(...skipping 14 matching lines...) Expand all
45 } 52 }
46 53
47 return TimeValue( 54 return TimeValue(
48 static_cast<TimeValue::SecondsType>( the_time.tv_sec + 55 static_cast<TimeValue::SecondsType>( the_time.tv_sec +
49 PosixZeroTimeSeconds ), 56 PosixZeroTimeSeconds ),
50 static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 57 static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec *
51 NANOSECONDS_PER_MICROSECOND ) ); 58 NANOSECONDS_PER_MICROSECOND ) );
52 } 59 }
53 60
54 } 61 }
OLDNEW
« no previous file with comments | « lib/Support/Unix/Signals.inc ('k') | lib/Support/Unix/Watchdog.inc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698