Changeset 17023
- Timestamp:
- Mar 17, 2008, 1:53:59 PM (18 years ago)
- Location:
- trunk/psLib/src/astro
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r14077 r17023 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.11 4$ $Name: not supported by cvs2svn $13 * @date $Date: 200 7-07-09 20:11:29$12 * @version $Revision: 1.115 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2008-03-17 23:53:43 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1545 1545 } 1546 1546 1547 // accepts a range of human readable times: 1548 // ISO (YYYY-MM-MMTHH:MM:SS[.sss][Z]) 1549 // YYYY/MM/DD,HH:MM:DD 1550 psTime* psTimeFromString(const char *input, 1551 psTimeType type) 1552 { 1553 1554 // Check for NULL string 1555 PS_ASSERT_PTR_NON_NULL(input,NULL); 1556 PS_ASSERT_INT_WITHIN_RANGE(type, PS_TIME_TAI, PS_TIME_TT, NULL); 1557 1558 psTime *outTime = NULL; 1559 1560 // Convert YYYY-MM-DDThh:mm:ss.sss[Z] in string form to tm time 1561 outTime = psTimeStrptime(input, "%Y-%m-%dT%H:%M:%S"); 1562 if (outTime) { 1563 outTime->type = type; 1564 return outTime; 1565 } 1566 psErrorClear (); 1567 1568 // Convert YYYY/MM/DD,hh:mm:ss.sss[Z] in string form to tm time 1569 outTime = psTimeStrptime(input, "%Y/%m/%d,%H:%M:%S"); 1570 if (outTime) { 1571 outTime->type = type; 1572 return outTime; 1573 } 1574 psErrorClear (); 1575 1576 // Convert YYYY/MM/DD@hh:mm:ss.sss[Z] in string form to tm time 1577 outTime = psTimeStrptime(input, "%Y/%m/%d@%H:%M:%S"); 1578 if (outTime) { 1579 outTime->type = type; 1580 return outTime; 1581 } 1582 psErrorClear (); 1583 1584 // try for date with assumed 00:00:00 time 1585 outTime = psTimeStrptime(input, "%Y-%m-%d"); 1586 if (outTime) { 1587 outTime->type = type; 1588 return outTime; 1589 } 1590 psErrorClear (); 1591 1592 // try for date with assumed 00:00:00 time 1593 outTime = psTimeStrptime(input, "%Y/%m/%d"); 1594 if (outTime) { 1595 outTime->type = type; 1596 return outTime; 1597 } 1598 psErrorClear (); 1599 1600 psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Specified Time string, '%s', is malformed. Must be in 'YYYY-MM-DDThh:mm:ss.sss' format."), input); 1601 return NULL; 1602 } 1603 1547 1604 psTime* psTimeFromTT(psS64 sec, 1548 1605 psU32 nsec) -
trunk/psLib/src/astro/psTime.h
r14452 r17023 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.5 7$ $Name: not supported by cvs2svn $14 * @date $Date: 200 7-08-09 01:40:07$13 * @version $Revision: 1.58 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2008-03-17 23:53:59 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 315 315 ); 316 316 317 /** Convert various human-readable formats to psTime. 318 * 319 * Converts human readable time formats to psTime. This function does not add or subtract leapseconds. 320 * 321 * @return psTime*: time 322 */ 323 psTime* psTimeFromString( 324 const char* input, ///< Input time to be converted. 325 psTimeType type ///< Time type. 326 ); 327 317 328 /** Convert timeval to psTime. 318 329 *
Note:
See TracChangeset
for help on using the changeset viewer.
