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

Side by Side Diff: base/third_party/nspr/prtime.cc

Issue 118469: compile on openbsd: mostly ifdefs and missing includes,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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
OLDNEW
1 /* Portions are Copyright (C) 2007 Google Inc */ 1 /* Portions are Copyright (C) 2007 Google Inc */
2 /* ***** BEGIN LICENSE BLOCK ***** 2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * 4 *
5 * The contents of this file are subject to the Mozilla Public License Version 5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with 6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at 7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/ 8 * http://www.mozilla.org/MPL/
9 * 9 *
10 * Software distributed under the License is distributed on an "AS IS" basis, 10 * Software distributed under the License is distributed on an "AS IS" basis,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // convert to microseconds which is what PRTime expects. 142 // convert to microseconds which is what PRTime expects.
143 CFAbsoluteTime absolute_time = 143 CFAbsoluteTime absolute_time =
144 CFGregorianDateGetAbsoluteTime(gregorian_date, NULL); 144 CFGregorianDateGetAbsoluteTime(gregorian_date, NULL);
145 PRTime result = static_cast<PRTime>(absolute_time); 145 PRTime result = static_cast<PRTime>(absolute_time);
146 result -= exploded->tm_params.tp_gmt_offset + 146 result -= exploded->tm_params.tp_gmt_offset +
147 exploded->tm_params.tp_dst_offset; 147 exploded->tm_params.tp_dst_offset;
148 result += kCFAbsoluteTimeIntervalSince1970; // PRTime epoch is 1970 148 result += kCFAbsoluteTimeIntervalSince1970; // PRTime epoch is 1970
149 result *= kSecondsToMicroseconds; 149 result *= kSecondsToMicroseconds;
150 result += exploded->tm_usec; 150 result += exploded->tm_usec;
151 return result; 151 return result;
152 #elif defined(OS_LINUX) 152 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
153 struct tm exp_tm = {0}; 153 struct tm exp_tm = {0};
154 exp_tm.tm_sec = exploded->tm_sec; 154 exp_tm.tm_sec = exploded->tm_sec;
155 exp_tm.tm_min = exploded->tm_min; 155 exp_tm.tm_min = exploded->tm_min;
156 exp_tm.tm_hour = exploded->tm_hour; 156 exp_tm.tm_hour = exploded->tm_hour;
157 exp_tm.tm_mday = exploded->tm_mday; 157 exp_tm.tm_mday = exploded->tm_mday;
158 exp_tm.tm_mon = exploded->tm_month; 158 exp_tm.tm_mon = exploded->tm_month;
159 exp_tm.tm_year = exploded->tm_year - 1900; 159 exp_tm.tm_year = exploded->tm_year - 1900;
160 160
161 // We assume that time_t is defined as a long. 161 // We assume that time_t is defined as a long.
162 time_t absolute_time = timegm(&exp_tm); 162 time_t absolute_time = timegm(&exp_tm);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 + 60 * localTime.tm_hour 1194 + 60 * localTime.tm_hour
1195 + 1440 * (localTime.tm_mday - 2); 1195 + 1440 * (localTime.tm_mday - 2);
1196 } 1196 }
1197 1197
1198 result->tm_params.tp_gmt_offset = zone_offset * 60; 1198 result->tm_params.tp_gmt_offset = zone_offset * 60;
1199 result->tm_params.tp_dst_offset = dst_offset * 60; 1199 result->tm_params.tp_dst_offset = dst_offset * 60;
1200 1200
1201 *result_imploded = PR_ImplodeTime(result); 1201 *result_imploded = PR_ImplodeTime(result);
1202 return PR_SUCCESS; 1202 return PR_SUCCESS;
1203 } 1203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698