New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] time64.c tweaks #15720
Labels
Comments
From @petdanceCreated by @petdanceTwo small tweaks in time64.c * The struct TM * to S_timegm64 is not modified, so make it be * Localize a variable in the Perl_gmtime64_r function to its Perl Info
|
From @petdancetime64.diffdiff --git a/time64.c b/time64.c
index f6ec740..9572180 100644
--- a/time64.c
+++ b/time64.c
@@ -124,7 +124,7 @@ static int S_is_exception_century(Year year)
}
-static Time64_T S_timegm64(struct TM *date) {
+static Time64_T S_timegm64(const struct TM *date) {
int days = 0;
Time64_T seconds = 0;
@@ -340,7 +340,6 @@ struct TM *Perl_gmtime64_r (const Time64_T *in_time, struct TM *p)
Time64_T m;
Time64_T time = *in_time;
Year year = 70;
- int cycles = 0;
assert(p != NULL);
@@ -389,7 +388,7 @@ struct TM *Perl_gmtime64_r (const Time64_T *in_time, struct TM *p)
if (m >= 0) {
/* Gregorian cycles, this is huge optimization for distant times */
- cycles = (int)Perl_floor(m / (Time64_T) days_in_gregorian_cycle);
+ const int cycles = (int)Perl_floor(m / (Time64_T) days_in_gregorian_cycle);
if( cycles ) {
m -= (cycles * (Time64_T) days_in_gregorian_cycle);
year += (cycles * years_in_gregorian_cycle);
@@ -410,6 +409,8 @@ struct TM *Perl_gmtime64_r (const Time64_T *in_time, struct TM *p)
v_tm_mon++;
}
} else {
+ int cycles;
+
year--;
/* Gregorian cycles */
|
From @petdanceClosing this ticket in favor of a new patch in #130128 |
@petdance - Status changed from 'new' to 'rejected' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Migrated from rt.perl.org#130121 (status was 'rejected')
Searchable as RT130121$
The text was updated successfully, but these errors were encountered: