This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
time64.c: Store fcn return in a variable
authorKarl Williamson <khw@cpan.org>
Sat, 14 Mar 2020 20:18:56 +0000 (14:18 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 19 Mar 2020 00:08:57 +0000 (18:08 -0600)
This is in preparation for it being used in more than one place

time64.c

index 9572180..475134f 100644 (file)
--- a/time64.c
+++ b/time64.c
@@ -467,11 +467,12 @@ struct TM *Perl_localtime64_r (const Time64_T *time, struct TM *local_tm)
     struct TM gm_tm;
     Year orig_year;
     int month_diff;
+    const bool use_system = SHOULD_USE_SYSTEM_LOCALTIME(*time);
 
     assert(local_tm != NULL);
 
     /* Use the system localtime() if time_t is small enough */
-    if( SHOULD_USE_SYSTEM_LOCALTIME(*time) ) {
+    if (use_system) {
         safe_time = (time_t)*time;
 
         TIME64_TRACE1("Using system localtime for %lld\n", *time);