diff options
author | Jim Meyering <jim@meyering.net> | 1994-02-10 19:14:24 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1994-02-10 19:14:24 +0000 |
commit | 4caa3d07cfffdb530250195f9df116d39b6fbcd0 (patch) | |
tree | 68fb192aa9380b9845c365cf7a65b79da3d29c80 /lib/getdate.y | |
parent | 589f6b1c17d8fe77d001d3ef8a0b40c748073f1a (diff) | |
download | coreutils-4caa3d07cfffdb530250195f9df116d39b6fbcd0.tar.xz |
merge with 1.9.2g
Diffstat (limited to 'lib/getdate.y')
-rw-r--r-- | lib/getdate.y | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/getdate.y b/lib/getdate.y index 35d064f48..63b9e7cfa 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -887,27 +887,25 @@ yylex() #define TM_YEAR_ORIGIN 1900 /* Yield A - B, measured in seconds. */ -static time_t -difftm(a, b) +static long +difftm (a, b) struct tm *a, *b; { int ay = a->tm_year + (TM_YEAR_ORIGIN - 1); int by = b->tm_year + (TM_YEAR_ORIGIN - 1); - return - ( - ( - ( - /* difference in day of year */ - a->tm_yday - b->tm_yday - /* + intervening leap days */ - + ((ay >> 2) - (by >> 2)) - - (ay/100 - by/100) - + ((ay/100 >> 2) - (by/100 >> 2)) - /* + difference in years * 365 */ - + (time_t)(ay-by) * 365 - )*24 + (a->tm_hour - b->tm_hour) - )*60 + (a->tm_min - b->tm_min) - )*60 + (a->tm_sec - b->tm_sec); + int days = ( + /* difference in day of year */ + a->tm_yday - b->tm_yday + /* + intervening leap days */ + + ((ay >> 2) - (by >> 2)) + - (ay/100 - by/100) + + ((ay/100 >> 2) - (by/100 >> 2)) + /* + difference in years * 365 */ + + (long)(ay-by) * 365 + ); + return (60*(60*(24*days + (a->tm_hour - b->tm_hour)) + + (a->tm_min - b->tm_min)) + + (a->tm_sec - b->tm_sec)); } time_t |