libtime++: Date and time calculation

◆ timeutil_date()

void timeutil_date ( timeutil_Ttime td,
long int  doy 
)

Definition at line 161 of file timeutil.c.

References timeutil_Ttime::doy, timeutil_DaysInLeapYear, timeutil_DaysInYear, timeutil_is_leap(), and TU_CHECKERROR.

Referenced by main(), and timeutil_norm().

164 {
165  int *days;
166 
167  td->doy=doy;
168 
169  days=timeutil_DaysInYear;
170  if (timeutil_is_leap(td->year)==1) { days=timeutil_DaysInLeapYear; }
171 
172  td->day=doy;
173  td->month=1;
174  while(td->day>days[td->month]) {
175  td->day=td->day-days[td->month];
176  td->month=td->month+1;
177  TU_CHECKERROR((td->month>13), "timeutil_date", "doy value out of range")
178  }
179 } /* timeutil_date */
long int doy
Definition: timeutil.h:58
static int timeutil_DaysInLeapYear[13]
Definition: timeutil.c:52
long int month
Definition: timeutil.h:58
#define TU_CHECKERROR(EXPR, SUB, STR)
Definition: timeutil.c:39
int timeutil_is_leap(long int year)
Definition: timeutil.c:137
long int day
Definition: timeutil.h:58
static int timeutil_DaysInYear[13]
Definition: timeutil.c:50
long int year
Definition: timeutil.h:58
Here is the call graph for this function:
Here is the caller graph for this function: