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

Side by Side Diff: base/time_posix.cc

Issue 7238021: Solaris patch (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixed some sysctl includes Created 9 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 | « base/threading/platform_thread_posix.cc ('k') | content/common/set_process_title.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 Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/time.h" 5 #include "base/time.h"
6 6
7 #include <sys/time.h> 7 #include <sys/time.h>
8 #include <time.h> 8 #include <time.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 struct tm timestruct; 103 struct tm timestruct;
104 timestruct.tm_sec = exploded.second; 104 timestruct.tm_sec = exploded.second;
105 timestruct.tm_min = exploded.minute; 105 timestruct.tm_min = exploded.minute;
106 timestruct.tm_hour = exploded.hour; 106 timestruct.tm_hour = exploded.hour;
107 timestruct.tm_mday = exploded.day_of_month; 107 timestruct.tm_mday = exploded.day_of_month;
108 timestruct.tm_mon = exploded.month - 1; 108 timestruct.tm_mon = exploded.month - 1;
109 timestruct.tm_year = exploded.year - 1900; 109 timestruct.tm_year = exploded.year - 1900;
110 timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this 110 timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this
111 timestruct.tm_yday = 0; // mktime/timegm ignore this 111 timestruct.tm_yday = 0; // mktime/timegm ignore this
112 timestruct.tm_isdst = -1; // attempt to figure it out 112 timestruct.tm_isdst = -1; // attempt to figure it out
113 #if !defined(OS_NACL) 113 #if !defined(OS_NACL) && !defined(OS_SOLARIS)
114 timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore 114 timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore
115 timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore 115 timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore
116 #endif 116 #endif
117 117
118 time_t seconds; 118 time_t seconds;
119 if (is_local) 119 if (is_local)
120 seconds = mktime(&timestruct); 120 seconds = mktime(&timestruct);
121 else 121 else
122 seconds = timegm(&timestruct); 122 seconds = timegm(&timestruct);
123 123
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 struct timeval Time::ToTimeVal() const { 205 struct timeval Time::ToTimeVal() const {
206 struct timeval result; 206 struct timeval result;
207 int64 us = us_ - kTimeTToMicrosecondsOffset; 207 int64 us = us_ - kTimeTToMicrosecondsOffset;
208 result.tv_sec = us / Time::kMicrosecondsPerSecond; 208 result.tv_sec = us / Time::kMicrosecondsPerSecond;
209 result.tv_usec = us % Time::kMicrosecondsPerSecond; 209 result.tv_usec = us % Time::kMicrosecondsPerSecond;
210 return result; 210 return result;
211 } 211 }
212 212
213 } // namespace base 213 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | content/common/set_process_title.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698