| OLD | NEW |
| 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 Loading... |
| 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_FREEBSD) |
| 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 time_t absolute_time = timegm(&exp_tm); | 161 time_t absolute_time = timegm(&exp_tm); |
| 162 | 162 |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |