@@ -682,23 +682,23 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
682
682
npy_int64 sfrac ;
683
683
npy_int64 ifrac ;
684
684
int sign ;
685
- npy_int64 PER_DAY ;
686
- npy_int64 PER_SEC ;
685
+ npy_int64 per_day ;
686
+ npy_int64 per_sec ;
687
687
688
688
/* Initialize the output to all zeros */
689
689
memset (out , 0 , sizeof (pandas_timedeltastruct ));
690
690
691
691
switch (base ) {
692
692
case NPY_FR_ns :
693
693
694
- PER_DAY = 86400000000000LL ;
695
- PER_SEC = 1000LL * 1000LL * 1000LL ;
694
+ per_day = 86400000000000LL ;
695
+ per_sec = 1000LL * 1000LL * 1000LL ;
696
696
697
697
// put frac in seconds
698
- if (td < 0 && td % PER_SEC != 0 )
699
- frac = td / PER_SEC - 1 ;
698
+ if (td < 0 && td % per_sec != 0 )
699
+ frac = td / per_sec - 1 ;
700
700
else
701
- frac = td / PER_SEC ;
701
+ frac = td / per_sec ;
702
702
703
703
if (frac < 0 ) {
704
704
sign = -1 ;
@@ -742,12 +742,12 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
742
742
}
743
743
744
744
sfrac = (out -> hrs * 3600LL + out -> min * 60LL
745
- + out -> sec ) * PER_SEC ;
745
+ + out -> sec ) * per_sec ;
746
746
747
747
if (sign < 0 )
748
748
out -> days = - out -> days ;
749
749
750
- ifrac = td - (out -> days * PER_DAY + sfrac );
750
+ ifrac = td - (out -> days * per_day + sfrac );
751
751
752
752
if (ifrac != 0 ) {
753
753
out -> ms = ifrac / (1000LL * 1000LL );
@@ -760,22 +760,18 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
760
760
out -> us = 0 ;
761
761
out -> ns = 0 ;
762
762
}
763
-
764
- out -> seconds = out -> hrs * 3600 + out -> min * 60 + out -> sec ;
765
- out -> microseconds = out -> ms * 1000 + out -> us ;
766
- out -> nanoseconds = out -> ns ;
767
763
break ;
768
764
769
765
case NPY_FR_us :
770
766
771
- PER_DAY = 86400000000LL ;
772
- PER_SEC = 1000LL * 1000LL ;
767
+ per_day = 86400000000LL ;
768
+ per_sec = 1000LL * 1000LL ;
773
769
774
770
// put frac in seconds
775
- if (td < 0 && td % PER_SEC != 0 )
776
- frac = td / PER_SEC - 1 ;
771
+ if (td < 0 && td % per_sec != 0 )
772
+ frac = td / per_sec - 1 ;
777
773
else
778
- frac = td / PER_SEC ;
774
+ frac = td / per_sec ;
779
775
780
776
if (frac < 0 ) {
781
777
sign = -1 ;
@@ -819,12 +815,12 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
819
815
}
820
816
821
817
sfrac = (out -> hrs * 3600LL + out -> min * 60LL
822
- + out -> sec ) * PER_SEC ;
818
+ + out -> sec ) * per_sec ;
823
819
824
820
if (sign < 0 )
825
821
out -> days = - out -> days ;
826
822
827
- ifrac = td - (out -> days * PER_DAY + sfrac );
823
+ ifrac = td - (out -> days * per_day + sfrac );
828
824
829
825
if (ifrac != 0 ) {
830
826
out -> ms = ifrac / 1000LL ;
@@ -841,14 +837,14 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
841
837
842
838
case NPY_FR_ms :
843
839
844
- PER_DAY = 86400000LL ;
845
- PER_SEC = 1000LL ;
840
+ per_day = 86400000LL ;
841
+ per_sec = 1000LL ;
846
842
847
843
// put frac in seconds
848
- if (td < 0 && td % PER_SEC != 0 )
849
- frac = td / PER_SEC - 1 ;
844
+ if (td < 0 && td % per_sec != 0 )
845
+ frac = td / per_sec - 1 ;
850
846
else
851
- frac = td / PER_SEC ;
847
+ frac = td / per_sec ;
852
848
853
849
if (frac < 0 ) {
854
850
sign = -1 ;
@@ -892,12 +888,12 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
892
888
}
893
889
894
890
sfrac = (out -> hrs * 3600LL + out -> min * 60LL
895
- + out -> sec ) * PER_SEC ;
891
+ + out -> sec ) * per_sec ;
896
892
897
893
if (sign < 0 )
898
894
out -> days = - out -> days ;
899
895
900
- ifrac = td - (out -> days * PER_DAY + sfrac );
896
+ ifrac = td - (out -> days * per_day + sfrac );
901
897
902
898
if (ifrac != 0 ) {
903
899
out -> ms = ifrac ;
@@ -911,16 +907,16 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
911
907
break ;
912
908
913
909
case NPY_FR_s :
914
- // special case where we can simplify many expressions bc PER_SEC =1
910
+ // special case where we can simplify many expressions bc per_sec =1
915
911
916
- PER_DAY = 86400000LL ;
917
- PER_SEC = 1L ;
912
+ per_day = 86400000LL ;
913
+ per_sec = 1L ;
918
914
919
915
// put frac in seconds
920
- if (td < 0 && td % PER_SEC != 0 )
921
- frac = td / PER_SEC - 1 ;
916
+ if (td < 0 && td % per_sec != 0 )
917
+ frac = td / per_sec - 1 ;
922
918
else
923
- frac = td / PER_SEC ;
919
+ frac = td / per_sec ;
924
920
925
921
if (frac < 0 ) {
926
922
sign = -1 ;
@@ -964,12 +960,12 @@ void pandas_timedelta_to_timedeltastruct(npy_timedelta td,
964
960
}
965
961
966
962
sfrac = (out -> hrs * 3600LL + out -> min * 60LL
967
- + out -> sec ) * PER_SEC ;
963
+ + out -> sec ) * per_sec ;
968
964
969
965
if (sign < 0 )
970
966
out -> days = - out -> days ;
971
967
972
- ifrac = td - (out -> days * PER_DAY + sfrac );
968
+ ifrac = td - (out -> days * per_day + sfrac );
973
969
974
970
if (ifrac != 0 ) {
975
971
out -> ms = 0 ;
0 commit comments