Skip to content

Commit

Permalink
Merge pull request Unidata#1937 from rkouznetsov/master
Browse files Browse the repository at this point in the history
Fix for :60 seconds in ncdump
  • Loading branch information
WardF authored Jan 26, 2021
2 parents 793d2d8 + 74ef4ea commit 025fb7b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libdispatch/nctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,17 +1090,21 @@ cdComp2Iso(cdCalenType timetype, int separator, cdCompTime comptime, char* time)
double dtmp, sec;
int ihr, imin, isec;
int nskip;
const double epssec = 0.5e-6; /* microsecond*/
const double epsmin = epssec / 60.; /*maximum error for comptime.hour < 24 , in hour */
const double epshr = epsmin / 60.; /*maximum error for comptime.hour < 24 , in hour */


if(cdValidateTime(timetype,comptime))
return;

ihr = (int)comptime.hour;
ihr = (int)(comptime.hour + epshr);
dtmp = 60.0 * (comptime.hour - (double)ihr);
imin = (int)dtmp;
imin = (int)(dtmp + epsmin);
sec = 60.0 * (dtmp - (double)imin);
isec = (int)sec;
isec = (int)(sec + epssec);

if(sec == isec)
if( sec - isec < epssec)
if(isec == 0)
if(imin == 0)
if(ihr == 0)
Expand Down

0 comments on commit 025fb7b

Please sign in to comment.