summaryrefslogtreecommitdiff
path: root/libc/misc/time/time.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-03-26 16:01:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-03-26 16:01:51 +0200
commitdb45ed982f8bfe8e84442cc8866b7f74bc6519a7 (patch)
tree4ce2f765cc8fcf44deb6cfb36a4a1dfea0049038 /libc/misc/time/time.c
parent899a2731262c4321f44a0faecf4134f6b6eacc3d (diff)
time.c: Readability improvements - no code changes
Pulled assignments out of ifs, added whitespace around operation symbols. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libc/misc/time/time.c')
-rw-r--r--libc/misc/time/time.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 8e2ebf12e..534a7aa9a 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -671,7 +671,7 @@ static int tm_isdst(register const struct tm *__restrict ptm,
isleap = __isleap(i);
--i;
day0 = (1
- + i /* Normal years increment 1 wday. */
+ + i /* Normal years increment 1 wday. */
+ (i/4)
- (i/100)
+ (i/400) ) % 7;
@@ -684,20 +684,22 @@ static int tm_isdst(register const struct tm *__restrict ptm,
}
} else if (r->rule_type == 'M') {
/* Find 0-based day number for 1st of the month. */
- day = 31*r->month - day_cor[r->month -1];
+ day = 31 * r->month - day_cor[r->month - 1];
if (isleap && (day >= 59)) {
++day;
}
- monlen = 31 + day_cor[r->month -1] - day_cor[r->month];
+ monlen = 31 + day_cor[r->month - 1] - day_cor[r->month];
if (isleap && (r->month == 2)) {
++monlen;
}
- /* Wweekday (0 is Sunday) of 1st of the month
+ /* Weekday (0 is Sunday) of 1st of the month
* is (day0 + day) % 7. */
- if ((mday = r->day - ((day0 + day) % 7)) >= 0) {
- mday -= 7; /* Back up into prev month since r->week>0. */
+ mday = r->day - ((day0 + day) % 7);
+ if (mday >= 0) {
+ mday -= 7; /* Back up into prev month since r->week > 0. */
}
- if ((mday += 7 * r->week) >= monlen) {
+ mday += 7 * r->week;
+ if (mday >= monlen) {
mday -= 7;
}
/* So, 0-based day number is... */