Reformat the WebRTC code base
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
diff --git a/rtc_base/timeutils.cc b/rtc_base/timeutils.cc
index 35c25c7..f195f2e 100644
--- a/rtc_base/timeutils.cc
+++ b/rtc_base/timeutils.cc
@@ -21,9 +21,13 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
+// clang-format off
+// clang formatting would put <windows.h> last,
+// which leads to compilation failure.
#include <windows.h>
#include <mmsystem.h>
#include <sys/timeb.h>
+// clang-format on
#endif
#include "rtc_base/checks.h"
@@ -164,8 +168,8 @@
int min = tm.tm_min;
int sec = tm.tm_sec;
- bool expiry_in_leap_year = (year % 4 == 0 &&
- (year % 100 != 0 || year % 400 == 0));
+ bool expiry_in_leap_year =
+ (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (year < 1970)
return -1;
@@ -188,13 +192,15 @@
// We will have added one day too much above if expiration is during a leap
// year, and expiration is in January or February.
- if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based.
+ if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based.
day -= 1;
// Combine all variables into seconds from 1970-01-01 00:00 (except |month|
// which was accumulated into |day| above).
- return (((static_cast<int64_t>
- (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec;
+ return (((static_cast<int64_t>(year - 1970) * 365 + day) * 24 + hour) * 60 +
+ min) *
+ 60 +
+ sec;
}
int64_t TimeUTCMicros() {
@@ -214,4 +220,4 @@
#endif
}
-} // namespace rtc
+} // namespace rtc