From a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:52:39 +0200 Subject: format files --- src/datetime_un.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'src/datetime_un.c') diff --git a/src/datetime_un.c b/src/datetime_un.c index e84806d..f8d24f2 100644 --- a/src/datetime_un.c +++ b/src/datetime_un.c @@ -7,29 +7,41 @@ datetime_sec datetime_untai(struct datetime *dt) int year; int day; int mon; - + year = dt->year + 1900; - + mon = dt->mon; - if (mon >= 2) { mon -= 2; } - else { mon += 10; --year; } - + if (mon >= 2) { + mon -= 2; + } else { + mon += 10; + --year; + } + day = (dt->mday - 1) * 10 + 5 + 306 * mon; day /= 10; - - if (day == 365) { year -= 3; day = 1460; } - else { day += 365 * (year % 4); } + + if (day == 365) { + year -= 3; + day = 1460; + } else { + day += 365 * (year % 4); + } year /= 4; - + day += 1461 * (year % 25); year /= 25; - - if (day == 36524) { year -= 3; day = 146096; } - else { day += 36524 * (year % 4); } + + if (day == 36524) { + year -= 3; + day = 146096; + } else { + day += 36524 * (year % 4); + } year /= 4; - + day += 146097 * (year - 5); day += 11017; - + return ((day * 24 + dt->hour) * 60 + dt->min) * 60 + dt->sec; } -- cgit v1.2.3