forked from pool/perl-Time-Moment
Add fix2038.patch to fix a year 2038 problem OBS-URL: https://build.opensuse.org/request/show/1000365 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Time-Moment?expand=0&rev=5
28 lines
869 B
Diff
28 lines
869 B
Diff
https://github.com/chansen/p5-time-moment/pull/48
|
|
|
|
commit c702dce560ed255e98384861e29297134fb60c65
|
|
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
|
|
Date: Wed Aug 31 05:29:27 2022 +0200
|
|
|
|
Fix year 2038 bug
|
|
|
|
Calculate seconds with 64-bit integers
|
|
|
|
Fixes #47
|
|
|
|
This PR was done while working on reproducible builds for openSUSE.
|
|
|
|
diff --git a/Moment.xs b/Moment.xs
|
|
index f8f5593..5ca561e 100644
|
|
--- a/Moment.xs
|
|
+++ b/Moment.xs
|
|
@@ -356,7 +356,7 @@ THX_moment_now(pTHX_ bool utc) {
|
|
if (tm == NULL)
|
|
croak("localtime() failed: %s", Strerror(errno));
|
|
|
|
- sec = ((1461 * (tm->tm_year - 1) >> 2) + tm->tm_yday - 25202) * 86400
|
|
+ sec = ((1461 * (tm->tm_year - 1) >> 2) + tm->tm_yday - 25202) * 86400LL
|
|
+ tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
|
|
off = (sec - tv.tv_sec) / 60;
|
|
}
|