Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
fdf0ed93
Commit
fdf0ed93
authored
Jun 17, 2009
by
Uwe Schulzweida
Browse files
change encode/decode_time to seconds
parent
71939e83
Changes
11
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
fdf0ed93
2009-??-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.3.1
* change encode/decode_time to seconds
* Version 1.4.0 released
2009-06-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* netCDF: reduced number of nc_enddef
...
...
app/cdi.c
View file @
fdf0ed93
...
...
@@ -35,7 +35,7 @@
void
decode_date
(
int
date
,
int
*
year
,
int
*
month
,
int
*
day
);
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
);
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
,
int
*
second
);
int
getopt
(
int
argc
,
char
*
const
argv
[],
const
char
*
optstring
);
...
...
@@ -110,21 +110,21 @@ static void printInfo(int gridtype, int date, int time, int code, double level,
{
static
int
rec
=
0
;
int
i
,
ivals
=
0
,
imiss
=
0
;
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
double
arrmean
,
arrmin
,
arrmax
;
if
(
!
rec
)
{
fprintf
(
stdout
,
" Rec : Date Time Code Level Size Miss : Minimum Mean Maximum
\n
"
);
" Rec : Date Time
Code Level Size Miss : Minimum Mean Maximum
\n
"
);
/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */
}
decode_date
(
date
,
&
year
,
&
month
,
&
day
);
decode_time
(
time
,
&
hour
,
&
minute
);
decode_time
(
time
,
&
hour
,
&
minute
,
&
second
);
fprintf
(
stdout
,
"%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d %3d %7g "
,
++
rec
,
year
,
month
,
day
,
hour
,
minute
,
code
,
level
);
fprintf
(
stdout
,
"%6d : %4.4d-%2.2d-%2.2d %2.2d:%2.2d
:%2.2d
%3d %7g "
,
++
rec
,
year
,
month
,
day
,
hour
,
minute
,
second
,
code
,
level
);
fprintf
(
stdout
,
"%7d "
,
datasize
);
...
...
@@ -472,7 +472,7 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
double
level
;
char
*
modelptr
,
*
instptr
;
int
prec
;
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
char
pstr
[
4
];
printf
(
" File format: "
);
...
...
@@ -630,10 +630,10 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
vtime
=
taxisInqRtime
(
taxisID
);
decode_date
(
vdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
vtime
,
&
hour
,
&
minute
);
decode_time
(
vtime
,
&
hour
,
&
minute
,
&
second
);
fprintf
(
stdout
,
" RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d"
,
year
,
month
,
day
,
hour
,
minute
);
fprintf
(
stdout
,
" RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d
:%2.2d
"
,
year
,
month
,
day
,
hour
,
minute
,
second
);
unit
=
taxisInqTunit
(
taxisID
);
if
(
unit
!=
CDI_UNDEFID
)
...
...
@@ -675,7 +675,7 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
}
}
fprintf
(
stdout
,
"
YYYY-MM-DD hh:mm
YYYY-MM-DD hh:mm
YYYY-MM-DD hh:mm
YYYY-MM-DD hh:mm
\n
"
);
fprintf
(
stdout
,
" YYYY-MM-DD hh:mm
:ss
YYYY-MM-DD hh:mm
:ss
YYYY-MM-DD hh:mm
:ss
YYYY-MM-DD hh:mm
:ss
\n
"
);
ntimeout
=
0
;
tsID
=
0
;
...
...
@@ -691,9 +691,10 @@ static void printShortinfo(int streamID, int vlistID, int vardis)
vtime
=
taxisInqVtime
(
taxisID
);
decode_date
(
vdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
vtime
,
&
hour
,
&
minute
);
decode_time
(
vtime
,
&
hour
,
&
minute
,
&
second
);
fprintf
(
stdout
,
" %6.4d-%2.2d-%2.2d %2.2d:%2.2d"
,
year
,
month
,
day
,
hour
,
minute
);
fprintf
(
stdout
,
" %5.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d"
,
year
,
month
,
day
,
hour
,
minute
,
second
);
ntimeout
++
;
tsID
++
;
}
...
...
src/calendar.c
View file @
fdf0ed93
...
...
@@ -203,7 +203,7 @@ int main(void)
int
vdate
,
vtime
;
int
ijulinc
;
int
i
,
j
=
0
;
int
year
,
mon
,
day
,
hour
,
min
;
int
year
,
mon
,
day
,
hour
,
min
ute
,
second
;
int
calday
,
secofday
;
/* 1 - Check valid range of years */
...
...
@@ -217,7 +217,7 @@ int main(void)
for
(
i
=
0
;
i
<
nmin
;
i
++
)
{
decode_date
(
vdate0
,
&
year
,
&
mon
,
&
day
);
decode_time
(
vtime0
,
&
hour
,
&
min
);
decode_time
(
vtime0
,
&
hour
,
&
min
ute
,
&
second
);
calday
=
date_to_calday
(
calendar
,
vdate0
);
secofday
=
time_to_sec
(
vtime0
);
...
...
@@ -231,7 +231,7 @@ int main(void)
year
++
;
vdate0
=
encode_date
(
year
,
mon
,
day
);
vtime0
=
encode_time
(
hour
,
min
);
vtime0
=
encode_time
(
hour
,
min
ute
,
second
);
}
printf
(
"stop time: %8d %4d
\n
"
,
vdate0
,
vtime0
);
...
...
@@ -250,11 +250,11 @@ int main(void)
for
(
i
=
0
;
i
<
nmin
;
i
++
)
{
decode_date
(
vdate0
,
&
year
,
&
mon
,
&
day
);
decode_time
(
vtime0
,
&
hour
,
&
min
);
decode_time
(
vtime0
,
&
hour
,
&
min
ute
,
&
second
);
if
(
++
min
>=
60
)
if
(
++
min
ute
>=
60
)
{
min
=
0
;
min
ute
=
0
;
if
(
++
hour
>=
24
)
{
hour
=
0
;
...
...
@@ -271,7 +271,7 @@ int main(void)
}
vdate0
=
encode_date
(
year
,
mon
,
day
);
vtime0
=
encode_time
(
hour
,
min
);
vtime0
=
encode_time
(
hour
,
min
ute
,
second
);
julday_add_seconds
(
ijulinc
,
&
calday
,
&
secofday
);
...
...
src/griblib.c
View file @
fdf0ed93
/* Automatically generated by m214003 at 2009-0
3-2
7, do not edit */
/* Automatically generated by m214003 at 2009-0
6-1
7, do not edit */
/* GRIBLIB_VERSION="1.3.
0
" */
/* GRIBLIB_VERSION="1.3.
1
" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
...
...
@@ -992,7 +992,7 @@ int gribRefTime(int *isec1)
rhour
=
ISEC1_Hour
;
rminute
=
ISEC1_Minute
;
time
=
encode_time
(
rhour
,
rminute
);
time
=
encode_time
(
rhour
,
rminute
,
0
);
return
(
time
)
;
}
...
...
@@ -1091,7 +1091,7 @@ void gribDateTime(int *isec1, int *date, int *time)
printf("new %d/%d/%d %d:%d\n", ryear, rmonth, rday, rhour, rminute);
*/
*
date
=
encode_date
(
ryear
,
rmonth
,
rday
);
*
time
=
encode_time
(
rhour
,
rminute
);
*
time
=
encode_time
(
rhour
,
rminute
,
0
);
return
;
}
...
...
@@ -8381,7 +8381,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return
(
gribLen
);
}
static
const
char
grb_libvers
[]
=
"1.3.
0
"
" of ""
Mar 2
7 2009"" ""1
2:47:36
"
;
static
const
char
grb_libvers
[]
=
"1.3.
1
"
" of ""
Jun 1
7 2009"" ""1
4:58:52
"
;
const
char
*
gribLibraryVersion
(
void
)
{
...
...
src/stream_cdf.c
View file @
fdf0ed93
...
...
@@ -191,7 +191,7 @@ static int splitBasetime(char *timeunits, TAXIS *taxis)
}
rdate
=
encode_date
(
year
,
month
,
day
);
rtime
=
encode_time
(
hour
,
minute
);
rtime
=
encode_time
(
hour
,
minute
,
second
);
(
*
taxis
).
rdate
=
rdate
;
(
*
taxis
).
rtime
=
rtime
;
...
...
@@ -700,7 +700,7 @@ void cdfDefTime(int streamID)
int
time_varid
;
int
time_bndsid
;
int
dims
[
2
];
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
char
unitstr
[
80
];
char
calstr
[
80
];
size_t
len
;
...
...
@@ -763,11 +763,11 @@ void cdfDefTime(int streamID)
}
decode_date
(
rdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
rtime
,
&
hour
,
&
minute
);
decode_time
(
rtime
,
&
hour
,
&
minute
,
&
second
);
if
(
timeunit
==
TUNIT_QUARTER
)
timeunit
=
TUNIT_MINUTE
;
sprintf
(
unitstr
,
"%s since %d-%02d-%02d %02d:%02d"
,
tunitNamePtr
(
timeunit
),
year
,
month
,
day
,
hour
,
minute
);
sprintf
(
unitstr
,
"%s since %d-%02d-%02d %02d:%02d
:%02d
"
,
tunitNamePtr
(
timeunit
),
year
,
month
,
day
,
hour
,
minute
,
second
);
}
len
=
strlen
(
unitstr
);
...
...
src/stream_grb.c
View file @
fdf0ed93
...
...
@@ -1775,7 +1775,7 @@ void grbDefCode(int *isec1, int code, int codetable)
void
grbDefTime
(
int
*
isec1
,
int
date
,
int
time
,
int
numavg
,
int
timeID
)
{
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
int
century
=
0
;
int
timetype
=
-
1
;
...
...
@@ -1793,7 +1793,7 @@ void grbDefTime(int *isec1, int date, int time, int numavg, int timeID)
rdate
=
taxisInqRdate
(
timeID
);
rtime
=
taxisInqRtime
(
timeID
);
decode_date
(
rdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
rtime
,
&
hour
,
&
minute
);
decode_time
(
rtime
,
&
hour
,
&
minute
,
&
second
);
century
=
year
/
100
;
...
...
@@ -1832,7 +1832,7 @@ void grbDefTime(int *isec1, int date, int time, int numavg, int timeID)
default:
factor
=
3600
;
ISEC1_TimeUnit
=
ISEC1_TABLE4_HOUR
;
break
;
}
decode_date
(
date
,
&
year
,
&
month
,
&
day
);
decode_time
(
time
,
&
hour
,
&
minute
);
decode_time
(
time
,
&
hour
,
&
minute
,
&
second
);
/*
printf("date time %d %d\n", date, time);
printf("year %d, month %d, day %d, hour %d, minute %d\n", year, month, day, hour, minute);
...
...
@@ -1856,7 +1856,7 @@ void grbDefTime(int *isec1, int date, int time, int numavg, int timeID)
if
(
timetype
==
TAXIS_ABSOLUTE
)
{
decode_date
(
date
,
&
year
,
&
month
,
&
day
);
decode_time
(
time
,
&
hour
,
&
minute
);
decode_time
(
time
,
&
hour
,
&
minute
,
&
second
);
century
=
year
/
100
;
...
...
@@ -2442,7 +2442,7 @@ void grbWriteVarDP(int streamID, int varID, const double *data, int nmiss)
gribExDP
(
isec0
,
isec1
,
isec2
,
fsec2
,
isec3
,
fsec3
,
isec4
,
(
double
*
)
&
data
[
levelID
*
datasize
],
datasize
,
(
int
*
)
gribbuffer
,
gribsize
,
&
iword
,
"C"
,
&
iret
);
if
(
iret
)
Error
(
func
,
"Problem during GRIB encode (errno = %d)!"
,
iret
);
;
if
(
iret
)
Error
(
func
,
"Problem during GRIB encode (errno = %d)!"
,
iret
);
nbytes
=
iword
*
sizeof
(
int
);
...
...
@@ -2561,7 +2561,7 @@ void grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data
gribExDP
(
isec0
,
isec1
,
isec2
,
fsec2
,
isec3
,
fsec3
,
isec4
,
(
double
*
)
data
,
datasize
,
(
int
*
)
gribbuffer
,
gribsize
,
&
iword
,
"C"
,
&
iret
);
if
(
iret
)
Error
(
func
,
"Problem during GRIB encode (errno = %d)!"
,
iret
);
;
if
(
iret
)
Error
(
func
,
"Problem during GRIB encode (errno = %d)!"
,
iret
);
nbytes
=
iword
*
sizeof
(
int
);
...
...
src/stream_ieg.c
View file @
fdf0ed93
...
...
@@ -210,7 +210,7 @@ int iegGetZaxisType(int iegleveltype)
void
iegDefTime
(
int
*
pdb
,
int
date
,
int
time
,
int
timeID
)
{
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
int
timetype
=
-
1
;
if
(
timeID
!=
-
1
)
timetype
=
taxisInqType
(
timeID
);
...
...
@@ -218,7 +218,7 @@ void iegDefTime(int *pdb, int date, int time, int timeID)
if
(
timetype
==
TAXIS_ABSOLUTE
||
timetype
==
TAXIS_RELATIVE
)
{
decode_date
(
date
,
&
year
,
&
month
,
&
day
);
decode_time
(
time
,
&
hour
,
&
minute
);
decode_time
(
time
,
&
hour
,
&
minute
,
&
second
);
IEG_P_Year
(
pdb
)
=
year
;
IEG_P_Month
(
pdb
)
=
month
;
...
...
@@ -754,7 +754,7 @@ void iegDateTime(int *pdb, int *date, int *time)
if
(
rminute
==
-
1
)
rminute
=
0
;
*
date
=
encode_date
(
ryear
,
rmonth
,
rday
);
*
time
=
encode_time
(
rhour
,
rminute
);
*
time
=
encode_time
(
rhour
,
rminute
,
0
);
}
...
...
src/stream_int.c
View file @
fdf0ed93
...
...
@@ -504,7 +504,7 @@ double cdiInqMissval(void)
{
cdiInitialize
();
return
(
cdiDefaultMissval
);
;
return
(
cdiDefaultMissval
);
}
...
...
src/taxis.c
View file @
fdf0ed93
...
...
@@ -995,7 +995,7 @@ void encode_timevalue(int days, int secs, int timeunit, double *timevalue)
void
timeval2vtime
(
double
timevalue
,
TAXIS
*
taxis
,
int
*
vdate
,
int
*
vtime
)
{
static
char
func
[]
=
"timeval2vtime"
;
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
int
rdate
,
rtime
;
int
timeunit
;
int
calendar
;
...
...
@@ -1011,7 +1011,7 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
rdate
=
(
*
taxis
).
rdate
;
rtime
=
(
*
taxis
).
rtime
;
decode_date
(
rdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
rtime
,
&
hour
,
&
minute
);
decode_time
(
rtime
,
&
hour
,
&
minute
,
&
second
);
if
(
timeunit
==
TUNIT_MONTH
&&
calendar
==
CALENDAR_360DAYS
)
{
...
...
@@ -1050,14 +1050,14 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
}
*
vdate
=
encode_date
(
year
,
month
,
day
);
*
vtime
=
encode_time
(
hour
,
minute
);
*
vtime
=
encode_time
(
hour
,
minute
,
second
);
}
double
vtime2timeval
(
int
vdate
,
int
vtime
,
TAXIS
*
taxis
)
{
int
ryear
,
rmonth
;
int
year
,
month
,
day
,
hour
,
minute
;
int
year
,
month
,
day
,
hour
,
minute
,
second
;
int
rdate
,
rtime
;
double
value
=
0
;
int
timeunit
;
...
...
@@ -1077,12 +1077,12 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
}
decode_date
(
rdate
,
&
ryear
,
&
rmonth
,
&
day
);
decode_time
(
rtime
,
&
hour
,
&
minute
);
decode_time
(
rtime
,
&
hour
,
&
minute
,
&
second
);
encode_caldaysec
(
calendar
,
ryear
,
rmonth
,
day
,
hour
,
minute
,
&
julday1
,
&
secofday1
);
decode_date
(
vdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
vtime
,
&
hour
,
&
minute
);
decode_time
(
vtime
,
&
hour
,
&
minute
,
&
second
);
timeunit0
=
timeunit
;
...
...
@@ -1118,7 +1118,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
{
static
char
func
[]
=
"splitTimevalue"
;
int
vdate
=
0
,
vtime
=
0
;
int
hour
,
minute
;
int
hour
,
minute
,
second
;
int
year
,
month
,
day
;
static
int
lwarn
=
TRUE
;
...
...
@@ -1129,11 +1129,12 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
if
(
vdate
<
0
)
vtime
=
(
int
)
(
-
(
timevalue
-
vdate
)
*
1440
+
0
.
01
);
else
vtime
=
(
int
)
((
timevalue
-
vdate
)
*
1440
+
0
.
01
);
vtime
=
(
int
)
(
(
timevalue
-
vdate
)
*
1440
+
0
.
01
);
hour
=
vtime
/
60
;
minute
=
vtime
-
hour
*
60
;
vtime
=
hour
*
100
+
minute
;
second
=
0
;
vtime
=
encode_time
(
hour
,
minute
,
second
);
}
else
if
(
timeunit
==
TUNIT_DAY
)
{
...
...
@@ -1141,11 +1142,12 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
if
(
vdate
<
0
)
vtime
=
(
int
)
(
-
(
timevalue
-
vdate
)
*
1440
+
0
.
01
);
else
vtime
=
(
int
)
((
timevalue
-
vdate
)
*
1440
+
0
.
01
);
vtime
=
(
int
)
(
(
timevalue
-
vdate
)
*
1440
+
0
.
01
);
hour
=
vtime
/
60
;
minute
=
vtime
-
hour
*
60
;
vtime
=
hour
*
100
+
minute
;
second
=
0
;
vtime
=
encode_time
(
hour
,
minute
,
second
);
}
else
if
(
timeunit
==
TUNIT_MONTH
)
{
...
...
@@ -1180,21 +1182,22 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
/* verify date and time */
decode_date
(
vdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
vtime
,
&
hour
,
&
minute
);
decode_time
(
vtime
,
&
hour
,
&
minute
,
&
second
);
if
(
month
>
17
||
day
>
31
||
hour
>
23
||
minute
>
59
)
if
(
month
>
17
||
day
>
31
||
hour
>
23
||
minute
>
59
||
second
>
59
)
{
if
(
(
month
>
17
||
day
>
31
)
&&
(
year
<
-
9999
||
year
>
9999
)
)
year
=
1
;
if
(
month
>
17
)
month
=
1
;
if
(
day
>
31
)
day
=
1
;
if
(
hour
>
23
)
hour
=
0
;
if
(
minute
>
59
)
minute
=
0
;
if
(
second
>
59
)
second
=
0
;
vdate
=
encode_date
(
year
,
month
,
day
);
vtime
=
encode_time
(
hour
,
minute
);
vtime
=
encode_time
(
hour
,
minute
,
second
);
Warning
(
func
,
"Reset wrong date/time to %4.4d-%2.2d-%2.2d %2.2d:%2.2d!"
,
year
,
month
,
day
,
hour
,
minute
);
Warning
(
func
,
"Reset wrong date/time to %4.4d-%2.2d-%2.2d %2.2d:%2.2d
:%2.2d
!"
,
year
,
month
,
day
,
hour
,
minute
,
second
);
}
*
date
=
vdate
;
...
...
@@ -1240,7 +1243,7 @@ double encode_timeval(int date, int time, TAXIS *taxis)
if
(
date
<
0
)
timevalue
=
-
(
-
date
+
(
hour
*
60
+
minute
)
/
1440
.);
else
timevalue
=
date
+
(
hour
*
60
+
minute
)
/
1440
.;
timevalue
=
date
+
(
hour
*
60
+
minute
)
/
1440
.;
}
}
else
...
...
src/timebase.c
View file @
fdf0ed93
...
...
@@ -30,14 +30,15 @@ int encode_date(int year, int month, int day)
}
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
)
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
,
int
*
second
)
{
*
hour
=
time
/
100
;
*
minute
=
time
-
*
hour
*
100
;
*
hour
=
time
/
100
;
*
minute
=
time
-
*
hour
*
100
;
*
second
=
0
;
}
int
encode_time
(
int
hour
,
int
minute
)
int
encode_time
(
int
hour
,
int
minute
,
int
second
)
{
int
time
;
...
...
@@ -154,11 +155,11 @@ int julday_to_date(int calendar, int julday)
int
time_to_sec
(
int
time
)
{
int
secofday
;
int
hour
,
minute
;
int
hour
,
minute
,
second
;
decode_time
(
time
,
&
hour
,
&
minute
);
decode_time
(
time
,
&
hour
,
&
minute
,
&
second
);
secofday
=
(
hour
*
60
+
minute
)
*
60
;
secofday
=
(
hour
*
60
+
minute
)
*
60
+
second
;
return
(
secofday
);
}
...
...
@@ -253,7 +254,7 @@ int main(void)
int
vdate
,
vtime
;
int
ijulinc
;
int
i
,
j
=
0
;
int
year
,
mon
,
day
,
hour
,
min
;
int
year
,
mon
,
day
,
hour
,
min
ute
,
second
;
int
julday
,
secofday
;
/* 1 - Check valid range of years */
...
...
@@ -267,7 +268,7 @@ int main(void)
for
(
i
=
0
;
i
<
nmin
;
i
++
)
{
decode_date
(
vdate0
,
&
year
,
&
mon
,
&
day
);
decode_time
(
vtime0
,
&
hour
,
&
min
);
decode_time
(
vtime0
,
&
hour
,
&
min
ute
,
&
second
);
julday
=
date_to_julday
(
calendar
,
vdate0
);
secofday
=
time_to_sec
(
vtime0
);
...
...
@@ -281,7 +282,7 @@ int main(void)
year
++
;
vdate0
=
encode_date
(
year
,
mon
,
day
);
vtime0
=
encode_time
(
hour
,
min
);
vtime0
=
encode_time
(
hour
,
min
ute
,
second
);
}
printf
(
"stop time: %8d %4d
\n
"
,
vdate0
,
vtime0
);
...
...
@@ -300,11 +301,11 @@ int main(void)
for
(
i
=
0
;
i
<
nmin
;
i
++
)
{
decode_date
(
vdate0
,
&
year
,
&
mon
,
&
day
);
decode_time
(
vtime0
,
&
hour
,
&
min
);
decode_time
(
vtime0
,
&
hour
,
&
min
ute
,
&
second
);
if
(
++
min
>=
60
)
if
(
++
min
ute
>=
60
)
{
min
=
0
;
min
ute
=
0
;
if
(
++
hour
>=
24
)
{
hour
=
0
;
...
...
@@ -321,7 +322,7 @@ int main(void)
}
vdate0
=
encode_date
(
year
,
mon
,
day
);
vtime0
=
encode_time
(
hour
,
min
);
vtime0
=
encode_time
(
hour
,
min
ute
,
second
);
julday_add_seconds
(
ijulinc
,
&
julday
,
&
secofday
);
...
...
src/timebase.h
View file @
fdf0ed93
...
...
@@ -7,8 +7,8 @@
void
decode_date
(
int
date
,
int
*
year
,
int
*
month
,
int
*
day
);
int
encode_date
(
int
year
,
int
month
,
int
day
);
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
);
int
encode_time
(
int
hour
,
int
minute
);
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
,
int
*
second
);
int
encode_time
(
int
hour
,
int
minute
,
int
second
);
void
decode_julday
(
int
calendar
,
int
julday
,
int
*
year
,
int
*
mon
,
int
*
day
);
int
encode_julday
(
int
calendar
,
int
year
,
int
month
,
int
day
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment