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

time_t fsd_datetime_after ( fsd_datetime_t dt,
time_t  t 
)

Return first timestamp after t which match date/time pattern dt.

Definition at line 201 of file datetime.c.

References fsd_datetime_fill(), fsd_datetime_mktime(), fsd_datetime_s::mask, fsd_datetime_s::month, and fsd_datetime_s::year.

Referenced by fsd_datetime_parse().

{
      char dbg[256];
      unsigned unfilled = ~dt->mask;
      time_t result;

      fsd_datetime_fill( dt, t );
      fsd_datetime_dump( dt, dbg, sizeof(dbg) );
      fsd_log_debug(( "filled: %s", dbg ));
      result = fsd_datetime_mktime( dt );

      if( result < t )
       {
            if( unfilled & FSD_DT_DAY )
             {
                  while( result < t )
                   {
                        fsd_log_debug(( "next day" ));
                        result += 24*3600;
                   }
             }
            else if( unfilled & FSD_DT_MONTH )
             {
                  while( result < t )
                   {
                        fsd_log_debug(( "next month" ));
                        dt->month++;
                        result = fsd_datetime_mktime( dt );
                   }
             }
            else if( unfilled & FSD_DT_YEAR )
             {
                  while( result < t )
                   {
                        fsd_log_debug(( "next year" ));
                        dt->year++;
                        result = fsd_datetime_mktime( dt );
                   }
             }
            else /* FIXME: error message */
                  fsd_exc_raise_fmt( FSD_ERRNO_INVALID_VALUE,
                              "'%s' is in the past", dbg );
       }

      return result;
}

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