IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 26, 2006, 6:13:07 PM (20 years ago)
Author:
jhoblitt
Message:

add psTimeStrptime()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psTime.c

    r7701 r7703  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.88 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-27 03:48:35 $
     12 *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-27 04:13:07 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    16291629}
    16301630
     1631psTime* psTimeStrptime(const char *s, const char *format)
     1632{
     1633    PS_ASSERT_PTR_NON_NULL(s, NULL);
     1634    PS_ASSERT_PTR_NON_NULL(format, NULL);
     1635
     1636    struct tm tmTime;
     1637    char *lastChar = strptime((char *)s, "%EY-%m-%d%t%T", &tmTime);
     1638    if (!lastChar) {
     1639        psError(PS_ERR_UNKNOWN, true, "error parsing time string");
     1640        return NULL;
     1641    }
     1642
     1643    if (*lastChar != '\0') {
     1644        psWarning("time string was not completely consumed\n");
     1645    }
     1646
     1647    psTime *time = psTimeFromTM(&tmTime);
     1648    if (!time) {
     1649        psError(PS_ERR_UNKNOWN, false, "failed to generate a psTime");
     1650        return NULL;
     1651    }
     1652
     1653    return time;
     1654}
     1655
    16311656psTime* psTimeMath(const psTime *time,
    16321657                   double delta)
Note: See TracChangeset for help on using the changeset viewer.