libroot: Fix build of new time files under GCC2.

This commit is contained in:
Augustin Cavalier
2023-08-30 22:46:36 -04:00
parent a8e2f08853
commit a573f9e4be
3 changed files with 9 additions and 1 deletions
@@ -14,6 +14,7 @@ long long __tm_to_secs(const struct tm *tm)
}
year += adj;
}
{
long long t = __year_to_secs(year, &is_leap);
t += __month_to_secs(month, is_leap);
t += 86400LL * (tm->tm_mday-1);
@@ -21,4 +22,5 @@ long long __tm_to_secs(const struct tm *tm)
t += 60LL * tm->tm_min;
t += tm->tm_sec;
return t;
}
}
@@ -10,9 +10,13 @@ long long __year_to_secs(long long year, int *is_leap)
return 31536000*(y-70) + 86400*leaps;
}
{
int cycles, centuries, leaps, rem;
if (!is_leap) is_leap = &(int){0};
if (!is_leap) {
static int isleap = 0;
is_leap = &isleap;
}
cycles = (year-100) / 400;
rem = (year-100) % 400;
if (rem < 0) {
@@ -44,4 +48,5 @@ long long __year_to_secs(long long year, int *is_leap)
leaps += 97*cycles + 24*centuries - *is_leap;
return (year-100) * 31536000LL + leaps * 86400LL + 946684800 + 86400;
}
}
+1
View File
@@ -7,6 +7,7 @@ UsePrivateHeaders
shared
;
SubDirSysHdrs [ FDirName $(SUBDIR) .. musl include ] ;
SubDirHdrs [ FDirName $(SUBDIR) .. musl time ] ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {