Skip to content
Snippets Groups Projects
Commit 680971e1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

use DATE_FORMAT and TIME_FORMAT string

parent 8d7ab236
No related branches found
No related tags found
No related merge requests found
......@@ -134,10 +134,10 @@ void *Diff(void *argument)
if ( operatorID == DIFFV ) vlistInqVarName(vlistID1, varID1, varname);
if ( operatorID == DIFFV )
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %-8s ",
fprintf(stdout, "%6d :"DATE_FORMAT" "TIME_FORMAT" %-8s ",
indg, year, month, day, hour, minute, second, varname);
else if ( operatorID == DIFF )
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %3d",
fprintf(stdout, "%6d :"DATE_FORMAT" "TIME_FORMAT" %3d",
indg, year, month, day, hour, minute, second, code);
fprintf(stdout, " %7g ", zaxisInqLevel(zaxisID, levelID));
......
......@@ -168,7 +168,7 @@ void *Filedes(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " RefTime = "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
unit = taxisInqTunit(taxisID);
......@@ -224,7 +224,7 @@ void *Filedes(void *argument)
decode_time(vtime, &hour, &minute, &second);
tsID++;
fprintf(stdout, " %5d %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " %5d "DATE_FORMAT" "TIME_FORMAT,
tsID, year, month, day, hour, minute, second);
fprintf(stdout, "\n");
}
......
......@@ -388,7 +388,7 @@ void *Importbinary(void *argument)
{
gr2t(pfi.grvals[3], (gadouble)(tsID+1), &dtim);
if ( cdoVerbose )
cdoPrint(" Reading timestep: %3d %4.4d-%2.2d-%2.2d %2.2d:%2.2d",
cdoPrint(" Reading timestep: %3d "DATE_FORMAT" "TIME_FORMAT,
tsID+1, dtim.yr, dtim.mo, dtim.dy, dtim.hr, dtim.mn);
vdate = encode_date(dtim.yr, dtim.mo, dtim.dy);
......
......@@ -298,10 +298,10 @@ void *Info(void *argument)
if ( operatorID == INFOV ) vlistInqVarName(vlistID, varID, varname);
if ( operatorID == INFOV )
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %-8s ",
fprintf(stdout, "%6d :"DATE_FORMAT" "TIME_FORMAT" %-8s ",
indg, year, month, day, hour, minute, second, varname);
else
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %3d",
fprintf(stdout, "%6d :"DATE_FORMAT" "TIME_FORMAT" %3d",
indg, year, month, day, hour, minute, second, code);
level = zaxisInqLevel(zaxisID, levelID);
......
......@@ -160,7 +160,7 @@ void *Intntime(void *argument)
*/
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
cdoPrint("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
cdoPrint(DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
}
......
......@@ -222,7 +222,7 @@ void *Inttime(void *argument)
*/
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
cdoPrint("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %f %d",
cdoPrint(DATE_FORMAT" "TIME_FORMAT" %f %d",
year, month, day, hour, minute, second,
juldate_to_seconds(juldate), calendar);
}
......
......@@ -193,7 +193,7 @@ void *Output(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %12.12g\n",
fprintf(stdout, DATE_FORMAT" "TIME_FORMAT" %12.12g\n",
year, month, day, hour, minute, second, array[0]);
}
else if ( operatorID == OUTPUTFLD )
......
......@@ -837,8 +837,8 @@ void *Outputgmt(void *argument)
fprintf(stdout, "# Increment = %d\n", ninc);
fprintf(stdout, "#\n");
fprintf(stdout, "# File = %s\n", cdoStreamName(0));
fprintf(stdout, "# Date = %4.4d-%2.2d-%2.2d\n", year, month, day);
fprintf(stdout, "# Time = %2.2d:%2.2d:%2.2d\n", hour, minute, second);
fprintf(stdout, "# Date = "DATE_FORMAT"\n", year, month, day);
fprintf(stdout, "# Time = "TIME_FORMAT"\n", hour, minute, second);
fprintf(stdout, "# Name = %s\n", varname);
fprintf(stdout, "# Code = %d\n", code);
}
......
......@@ -119,10 +119,10 @@ void *Pinfo(void *argument)
if ( operatorID == PINFOV ) vlistInqVarName(vlistID1, varID, varname);
if ( operatorID == PINFOV )
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %-8s ",
fprintf(stdout, "%6d : "DATE_FORMAT" "TIME_FORMAT" %-8s ",
indg, year, month, day, hour, minute, second, varname);
else
fprintf(stdout, "%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %3d",
fprintf(stdout, "%6d : "DATE_FORMAT" "TIME_FORMAT" %3d",
indg, year, month, day, hour, minute, second, code);
level = zaxisInqLevel(zaxisID, levelID);
......
......@@ -320,8 +320,8 @@ void *Seasstat(void *argument)
decode_date(vdate1, &year1, &month1, &day1);
decode_time(vtime1, &hour1, &minute1, &second1);
cdoPrint("season %3d %3s "
"start %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d "
"end %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d "
"start "DATE_FORMAT" "TIME_FORMAT" "
"end "DATE_FORMAT" "TIME_FORMAT" "
"ntimesteps %d",
nseason, seas_name[seas0],
year0, month0, day0, hour0, minute0, second0,
......@@ -337,7 +337,7 @@ void *Seasstat(void *argument)
{
int year, month, day;
decode_date(vdate0, &year, &month, &day);
cdoWarning("Season %3d (%4.4d-%2.2d-%2.2d) has only %d input time step%s!",
cdoWarning("Season %3d ("DATE_FORMAT") has only %d input time step%s!",
otsID, year, month, day, nsets, nsets == 1 ? "" : "s");
}
......
......@@ -142,7 +142,7 @@ void *Showinfo(void *argument)
{
/* if ( ndate == 10 ) { ndate = 0; fprintf(stdout, "\n"); } */
date0 = vdate;
fprintf(stdout, " %4.4d-%2.2d-%2.2d", year, month, day);
fprintf(stdout, " "DATE_FORMAT, year, month, day);
ndate++;
}
......@@ -164,7 +164,7 @@ void *Showinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " %4.4d-%2.2d-%2.2d,%2.2d:%2.2d:%2.2d",
fprintf(stdout, " "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
tsID++;
nout++;
......
......@@ -233,7 +233,7 @@ void *Sinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " RefTime = "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
unit = taxisInqTunit(taxisID);
......@@ -294,7 +294,7 @@ void *Sinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " %5.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
ntimeout++;
tsID++;
......
......@@ -142,9 +142,9 @@ void printBounds(int taxisID, int calendar)
decode_date(vdate1, &year1, &month1, &day1);
decode_time(vtime1, &hour1, &minute1, &second1);
fprintf(stdout, "%5.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, DATE_FORMAT" "TIME_FORMAT,
year0, month0, day0, hour0, minute0, second0);
fprintf(stdout, "%5.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, DATE_FORMAT" "TIME_FORMAT,
year1, month1, day1, hour1, minute1, second1);
juldate0 = juldate_encode(calendar, vdate0, vtime0);
......@@ -287,7 +287,7 @@ void *Tinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " RefTime = "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
unit = taxisInqTunit(taxisID);
......@@ -316,7 +316,7 @@ void *Tinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, "%6d %5.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, "%6d "DATE_FORMAT" "TIME_FORMAT,
tsID+1, year, month, day, hour, minute, second);
if ( tsID )
......@@ -408,12 +408,12 @@ void *Tinfo(void *argument)
decode_date(vdate_first, &year, &month, &day);
decode_time(vtime_first, &hour, &minute, &second);
fprintf(stdout, " Start date : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n",
fprintf(stdout, " Start date : "DATE_FORMAT" "TIME_FORMAT"\n",
year, month, day, hour, minute, second);
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " End date : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n",
fprintf(stdout, " End date : "DATE_FORMAT" "TIME_FORMAT"\n",
year, month, day, hour, minute, second);
fprintf(stdout, " Increment : %3d %s%s\n",
incperiod0, tunits[incunit0], incperiod0>1?"s":"");
......@@ -455,7 +455,7 @@ void *Tinfo(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute, &second);
fprintf(stdout, " %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
fprintf(stdout, " "DATE_FORMAT" "TIME_FORMAT,
year, month, day, hour, minute, second);
ntimeout++;
tsID++;
......
......@@ -107,6 +107,10 @@ char *strdup(const char *s);
#define CDO_EXP_LOCAL 1
#define CDO_EXP_REMOTE 2
#define DATE_FORMAT "%5.4d-%2.2d-%2.2d"
#define TIME_FORMAT "%2.2d:%2.2d:%2.2d"
enum {DATE_FIRST, DATE_LAST, DATE_MIDDLE};
void strtolower(char *str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment