get_calendar_ts.c File Reference

Get year,month,day,hour,min,sec (time structure) given time in udunits. More...

#include <utils.h>
Include dependency graph for get_calendar_ts.c:

Go to the source code of this file.

Functions

int get_calendar_ts (tstruct *timeout, char *tunits, double *timein, int ntime)
 Get year,month,day,hour,min,sec (time structure) given time in udunits.

Detailed Description

Get year,month,day,hour,min,sec (time structure) given time in udunits.

Definition in file get_calendar_ts.c.


Function Documentation

int get_calendar_ts ( tstruct timeout,
char *  tunits,
double *  timein,
int  ntime 
)

Get year,month,day,hour,min,sec (time structure) given time in udunits.

Parameters:
[out] timeout Time structure vector
[out] tunits Time units (udunits)
[in] timein Input time vector values
[in] ntime Number of times

Definition at line 58 of file get_calendar_ts.c.

References TRUE.

Referenced by main(), and remove_clim().

00058                                                                            {
00059 
00067   int t; /* Time loop counter */
00068   int istat; /* Diagnostic status */
00069 
00070   utUnit dataunit; /* Data time units */
00071 
00072   /* Initialize udunits */
00073   if (utIsInit() != TRUE)
00074     istat = utInit("");
00075 
00076   /* Get time units */
00077   istat = utScan(tunits,  &dataunit);
00078   
00079   /* Loop over times and retrieve day, month, year */
00080   for (t=0; t<ntime; t++) {
00081     istat = utCalendar(timein[t], &dataunit, &(timeout[t].year), &(timeout[t].month), &(timeout[t].day), &(timeout[t].hour), &(timeout[t].min), &(timeout[t].sec));
00082     if (istat < 0) {
00083       (void) utTerm();
00084       return -1;
00085     }
00086   }
00087 
00088   /* Terminate udunits */
00089   (void) utTerm();
00090 
00091   /* Success status */
00092   return 0;
00093 }


Generated on 12 May 2016 for DSCLIM by  doxygen 1.6.1