Logo Search packages:      
Sourcecode: pbs-drmaa version File versions

void fsd_datetime_fill ( fsd_datetime_t dt,
time_t  filler 
)

Fill unset fields of fsd_datetime_t structure according to timestamp.

Parameters:
dtWill be filled with local time representation of filler.
fillerSeconds since epoch.

Definition at line 99 of file datetime.c.

References fsd_datetime_s::day, fsd_timezone(), fsd_datetime_s::hour, fsd_datetime_s::mask, fsd_datetime_s::minute, fsd_datetime_s::month, fsd_datetime_s::second, fsd_datetime_s::tz_delta, and fsd_datetime_s::year.

Referenced by fsd_datetime_after().

{
      unsigned unfilled = ~dt->mask;
      struct tm t;

#ifdef DEBUGGING
      char dbg[256];
      fsd_datetime_dump( dt, dbg, sizeof(dbg) );
      fsd_log_enter(( "(dt={%s}, filler=%u)",
                        dbg, (unsigned)filler ));
#endif

#ifdef HAVE_STRUCT_TM_GMTOFF
      /*
       * glibc have tm_gmtoff field in tm struct
       * which is number of second east from UTC
       */
      if( unfilled & FSD_DT_TZ_DELTA )
       {
            localtime_r( &filler, &t );
            dt->tz_delta = t.tm_gmtoff;
       }
      else
       {
            filler += dt->tz_delta;
            gmtime_r( &filler, &t );
       }
#else /* ! __GNUC__ */
      if( unfilled & FSD_DT_TZ_DELTA )
            dt->tz_delta = fsd_timezone( filler );
      filler += dt->tz_delta;
      gmtime_r( &filler, &t );
#endif

      if( unfilled & FSD_DT_YEAR )
            dt->year = t.tm_year + 1900;
      else if( dt->year < 100 )
            dt->year += 100 * ( (t.tm_year+1900)/100 );
      if( unfilled & FSD_DT_MONTH )
            dt->month = t.tm_mon + 1;
      if( unfilled & FSD_DT_DAY )
            dt->day = t.tm_mday;
      if( unfilled & FSD_DT_HOUR )
            dt->hour = t.tm_hour;
      if( unfilled & FSD_DT_MINUTE )
            dt->minute = t.tm_min;
      if( unfilled & FSD_DT_SECOND )
            dt->second = 0;

      dt->mask |= FSD_DT_ALL;

#ifdef DEBUGGING
      fsd_datetime_dump( dt, dbg, sizeof(dbg) );
      fsd_log_return(( ": dt={%s}", dbg ));
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index