Commit 4fb3c975 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed datetimeCmp() to datetimeDiffer().

parent 0adca701
...@@ -9,10 +9,10 @@ typedef struct ...@@ -9,10 +9,10 @@ typedef struct
DateTime; DateTime;
static inline int static inline int
datetimeCmp(DateTime dt1, DateTime dt2) datetimeDiffer(DateTime dt1, DateTime dt2)
{ {
return 2 * ((dt1.date > dt2.date) - (dt1.date < dt2.date)) return (2 * ((dt1.date > dt2.date) - (dt1.date < dt2.date))
+ (dt1.time > dt2.time) - (dt1.time < dt2.time); + (dt1.time > dt2.time) - (dt1.time < dt2.time)) != 0;
} }
......
...@@ -810,7 +810,7 @@ int cgribexScanTimestep1(stream_t *streamptr) ...@@ -810,7 +810,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
{ {
if ( recID < nrecs ) break; if ( recID < nrecs ) break;
if ( warn_time ) if ( warn_time )
if ( datetimeCmp(datetime, datetime0) != 0 ) if ( datetimeDiffer(datetime, datetime0) )
{ {
gribWarning("Inconsistent verification time!", nrecs_scanned, tsID+1, paramstr, level1, level2); gribWarning("Inconsistent verification time!", nrecs_scanned, tsID+1, paramstr, level1, level2);
warn_time = false; warn_time = false;
...@@ -818,7 +818,7 @@ int cgribexScanTimestep1(stream_t *streamptr) ...@@ -818,7 +818,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
} }
else else
{ {
if ( datetimeCmp(datetime, datetime0) != 0 ) break; if ( datetimeDiffer(datetime, datetime0) ) break;
if ( recID < nrecs ) if ( recID < nrecs )
{ {
...@@ -1017,7 +1017,7 @@ int cgribexScanTimestep2(stream_t * streamptr) ...@@ -1017,7 +1017,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
{ {
if ( records[recID].used ) if ( records[recID].used )
{ {
if ( datetimeCmp(datetime, datetime0) != 0 ) break; if ( datetimeDiffer(datetime, datetime0) ) break;
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr, level1, level2); gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr, level1, level2);
continue; continue;
...@@ -1227,7 +1227,7 @@ int cgribexScanTimestep(stream_t * streamptr) ...@@ -1227,7 +1227,7 @@ int cgribexScanTimestep(stream_t * streamptr)
char paramstr_[32]; char paramstr_[32];
cdiParamToString(param, paramstr_, sizeof(paramstr_)); cdiParamToString(param, paramstr_, sizeof(paramstr_));
if ( datetimeCmp(datetime, datetime0) != 0 ) break; if ( datetimeDiffer(datetime, datetime0) ) break;
if ( CDI_Debug ) if ( CDI_Debug )
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr_, level1, level2); gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr_, level1, level2);
......
...@@ -254,7 +254,7 @@ void extScanTimestep1(stream_t *streamptr) ...@@ -254,7 +254,7 @@ void extScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished; goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime}; DateTime datetime = { .date = vdate, .time = vtime};
if ( datetimeCmp(datetime, datetime0) ) if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); Warning("Inconsistent verification time for code %d level %d", rcode, rlevel);
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "calendar.h" #include "calendar.h"
#include "subtype.h" #include "subtype.h"
#include "cgribex.h" /* gribGetSize, gribRead, gribGetZip, GRIB1_LTYPE_99 */ #include "cgribex.h" /* gribGetSize, gribRead, gribGetZip, GRIB1_LTYPE_99 */
#include "gribapi.h" #include "gribapi.h"
...@@ -1001,7 +1000,7 @@ int gribapiScanTimestep1(stream_t * streamptr) ...@@ -1001,7 +1000,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
if ( datetime0.date == 10101 && datetime0.time == 0 ) if ( datetime0.date == 10101 && datetime0.time == 0 )
{ {
if ( datetimeCmp(datetime, datetime0) || !nrecs ) //Do we really need this condition? I have included it in order not to change the number of times gribapiGetDataDateTime() etc. get called. But if those are sideeffect-free, this condition should be removed. if ( datetimeDiffer(datetime, datetime0) || !nrecs ) //Do we really need this condition? I have included it in order not to change the number of times gribapiGetDataDateTime() etc. get called. But if those are sideeffect-free, this condition should be removed.
{ {
datetime0 = datetime; datetime0 = datetime;
gribapiGetDataDateTime(gh, &rdate, &rtime); gribapiGetDataDateTime(gh, &rdate, &rtime);
...@@ -1210,7 +1209,7 @@ int gribapiScanTimestep2(stream_t * streamptr) ...@@ -1210,7 +1209,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
if ( CDI_inventory_mode == 1 ) break; if ( CDI_inventory_mode == 1 ) break;
else else
{ {
if ( datetimeCmp(datetime, datetime0) != 0 ) break; if ( datetimeDiffer(datetime, datetime0) ) break;
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2); gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2);
continue; continue;
...@@ -1404,7 +1403,7 @@ int gribapiScanTimestep(stream_t * streamptr) ...@@ -1404,7 +1403,7 @@ int gribapiScanTimestep(stream_t * streamptr)
{ {
if ( records[recID].used ) if ( records[recID].used )
{ {
if ( datetimeCmp(datetime, datetime0) != 0 ) break; if ( datetimeDiffer(datetime, datetime0) ) break;
if ( CDI_Debug ) if ( CDI_Debug )
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2); gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2);
......
...@@ -721,7 +721,7 @@ void iegScanTimestep1(stream_t *streamptr) ...@@ -721,7 +721,7 @@ void iegScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished; goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime}; DateTime datetime = { .date = vdate, .time = vtime};
if ( datetimeCmp(datetime, datetime0) ) if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for param %d level %d", param, rlevel); Warning("Inconsistent verification time for param %d level %d", param, rlevel);
} }
......
...@@ -255,7 +255,7 @@ void srvScanTimestep1(stream_t *streamptr) ...@@ -255,7 +255,7 @@ void srvScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished; goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime }; DateTime datetime = { .date = vdate, .time = vtime };
if ( datetimeCmp(datetime, datetime0) ) if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); Warning("Inconsistent verification time for code %d level %d", rcode, rlevel);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment