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

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

Issue 1713433002: Moved macros into prtime.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved location of macros Created 4 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 | « base/third_party/nspr/prtime.h ('k') | no next file » | no next file with comments »
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include <limits.h> 68 #include <limits.h>
69 69
70 #include "base/logging.h" 70 #include "base/logging.h"
71 #include "base/third_party/nspr/prtime.h" 71 #include "base/third_party/nspr/prtime.h"
72 #include "build/build_config.h" 72 #include "build/build_config.h"
73 73
74 #include <errno.h> /* for EINVAL */ 74 #include <errno.h> /* for EINVAL */
75 #include <time.h> 75 #include <time.h>
76 76
77 /* 77 /*
78 * Long-long (64-bit signed integer type) support macros used by
79 * PR_ImplodeTime().
80 * See http://lxr.mozilla.org/nspr/source/pr/include/prlong.h
81 */
82 #define LL_I2L(l, i) ((l) = (PRInt64)(i))
83 #define LL_MUL(r, a, b) ((r) = (a) * (b))
84 #define LL_ADD(r, a, b) ((r) = (a) + (b))
85 #define LL_SUB(r, a, b) ((r) = (a) - (b))
86
87 /*
88 * The COUNT_LEAPS macro counts the number of leap years passed by 78 * The COUNT_LEAPS macro counts the number of leap years passed by
89 * till the start of the given year Y. At the start of the year 4 79 * till the start of the given year Y. At the start of the year 4
90 * A.D. the number of leap years passed by is 0, while at the start of 80 * A.D. the number of leap years passed by is 0, while at the start of
91 * the year 5 A.D. this count is 1. The number of years divisible by 81 * the year 5 A.D. this count is 1. The number of years divisible by
92 * 100 but not divisible by 400 (the non-leap years) is deducted from 82 * 100 but not divisible by 400 (the non-leap years) is deducted from
93 * the count to get the correct number of leap years. 83 * the count to get the correct number of leap years.
94 * 84 *
95 * The COUNT_DAYS macro counts the number of days since 01/01/01 till the 85 * The COUNT_DAYS macro counts the number of days since 01/01/01 till the
96 * start of the given year Y. The number of days at the start of the year 86 * start of the given year Y. The number of days at the start of the year
97 * 1 is 0 while the number of days at the start of the year 2 is 365 87 * 1 is 0 while the number of days at the start of the year 2 is 365
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 + 60 * localTime.tm_hour 1177 + 60 * localTime.tm_hour
1188 + 1440 * (localTime.tm_mday - 2); 1178 + 1440 * (localTime.tm_mday - 2);
1189 } 1179 }
1190 1180
1191 result->tm_params.tp_gmt_offset = zone_offset * 60; 1181 result->tm_params.tp_gmt_offset = zone_offset * 60;
1192 result->tm_params.tp_dst_offset = dst_offset * 60; 1182 result->tm_params.tp_dst_offset = dst_offset * 60;
1193 1183
1194 *result_imploded = PR_ImplodeTime(result); 1184 *result_imploded = PR_ImplodeTime(result);
1195 return PR_SUCCESS; 1185 return PR_SUCCESS;
1196 } 1186 }
OLDNEW
« no previous file with comments | « base/third_party/nspr/prtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698