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

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

Issue 266193002: Extend PR_ParseTimeString() to accept some ISO 8601 formats to fix timezone parsing in SyslogParser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix microsecond parsing for Windows and for timezoneless (local time) inputs. Created 6 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
« no previous file with comments | « no previous file | base/third_party/nspr/prtime.cc » ('j') | base/time/pr_time_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Portions are Copyright (C) 2011 Google Inc */ 1 /* Portions are Copyright (C) 2011 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #define PR_TRUE 1 66 #define PR_TRUE 1
67 #define PR_FALSE 0 67 #define PR_FALSE 0
68 68
69 typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; 69 typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
70 70
71 #define PR_ASSERT DCHECK 71 #define PR_ASSERT DCHECK
72 #define PR_CALLBACK 72 #define PR_CALLBACK
73 #define PR_INT16_MAX 32767 73 #define PR_INT16_MAX 32767
74 #define NSPR_API(__type) extern __type 74 #define NSPR_API(__type) extern __type
75 75
76 #define LL_I2L(l, i) ((l) = (PRInt64)(i))
77 #define LL_MUL(r, a, b) ((r) = (a) * (b))
78
79 /**********************************************************************/ 76 /**********************************************************************/
80 /************************* TYPES AND CONSTANTS ************************/ 77 /************************* TYPES AND CONSTANTS ************************/
81 /**********************************************************************/ 78 /**********************************************************************/
82 79
83 #define PR_MSEC_PER_SEC 1000UL 80 #define PR_MSEC_PER_SEC 1000UL
84 #define PR_USEC_PER_SEC 1000000UL 81 #define PR_USEC_PER_SEC 1000000UL
85 #define PR_NSEC_PER_SEC 1000000000UL 82 #define PR_NSEC_PER_SEC 1000000000UL
86 #define PR_USEC_PER_MSEC 1000UL 83 #define PR_USEC_PER_MSEC 1000UL
87 #define PR_NSEC_PER_MSEC 1000000UL 84 #define PR_NSEC_PER_MSEC 1000000UL
88 85
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 * Mon Jan 16 16:12 +0130 1989 223 * Mon Jan 16 16:12 +0130 1989
227 * 6 May 1992 16:41-JST (Wednesday) 224 * 6 May 1992 16:41-JST (Wednesday)
228 * 22-AUG-1993 10:59:12.82 225 * 22-AUG-1993 10:59:12.82
229 * 22-AUG-1993 10:59pm 226 * 22-AUG-1993 10:59pm
230 * 22-AUG-1993 12:59am 227 * 22-AUG-1993 12:59am
231 * 22-AUG-1993 12:59 PM 228 * 22-AUG-1993 12:59 PM
232 * Friday, August 04, 1995 3:54 PM 229 * Friday, August 04, 1995 3:54 PM
233 * 06/21/95 04:24:34 PM 230 * 06/21/95 04:24:34 PM
234 * 20/06/95 21:07 231 * 20/06/95 21:07
235 * 95-06-08 19:32:48 EDT 232 * 95-06-08 19:32:48 EDT
233 * 1995-06-17T23:11:25.342156Z
236 * 234 *
237 * If the input string doesn't contain a description of the timezone, 235 * If the input string doesn't contain a description of the timezone,
238 * we consult the `default_to_gmt' to decide whether the string should 236 * we consult the `default_to_gmt' to decide whether the string should
239 * be interpreted relative to the local time zone (PR_FALSE) or GMT (PR_TRUE). 237 * be interpreted relative to the local time zone (PR_FALSE) or GMT (PR_TRUE).
240 * The correct value for this argument depends on what standard specified 238 * The correct value for this argument depends on what standard specified
241 * the time string which you are parsing. 239 * the time string which you are parsing.
242 */ 240 */
243 241
244 /* 242 /*
245 * This is the only funtion that should be called from outside base, and only 243 * This is the only funtion that should be called from outside base, and only
246 * from the unit test. 244 * from the unit test.
247 */ 245 */
248 246
249 BASE_EXPORT PRStatus PR_ParseTimeString ( 247 BASE_EXPORT PRStatus PR_ParseTimeString (
250 const char *string, 248 const char *string,
251 PRBool default_to_gmt, 249 PRBool default_to_gmt,
252 PRTime *result); 250 PRTime *result);
253 251
254 #endif // BASE_PRTIME_H__ 252 #endif // BASE_PRTIME_H__
OLDNEW
« no previous file with comments | « no previous file | base/third_party/nspr/prtime.cc » ('j') | base/time/pr_time_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698