Changeset 8772
- Timestamp:
- Sep 7, 2006, 2:30:03 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psTime.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r8627 r8772 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.9 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 8-26 04:34:27$12 * @version $Revision: 1.95 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-09-08 00:30:03 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1490 1490 psTimeType type) 1491 1491 { 1492 psS32 millisecond;1493 struct tm tmTime;1494 psTime *outTime = NULL;1495 1492 1496 1493 // Check for NULL string … … 1498 1495 PS_ASSERT_INT_WITHIN_RANGE(type, PS_TIME_TAI, PS_TIME_TT, NULL); 1499 1496 1500 // Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time 1501 if (sscanf(input, "%d-%d-%dT%d:%d:%d.%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday, 1502 &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) { 1497 // Convert YYYY-MM-DDThh:mm:ss.sss[Z] in string form to tm time 1498 psTime *outTime = psTimeStrptime(input, "%Y-%m-%dT%H:%M:%S"); 1499 1500 if (!outTime) { 1503 1501 psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Specified ISO Time string, '%s', is malformed. Must be in 'YYYY-MM-DDThh:mm:ss.sss' format."), input); 1504 1502 return NULL; 1505 }1506 1507 PS_ASSERT_INT_NONNEGATIVE(tmTime.tm_year, outTime);1508 PS_ASSERT_INT_WITHIN_RANGE(tmTime.tm_mon,1,12,outTime);1509 PS_ASSERT_INT_WITHIN_RANGE(tmTime.tm_mday,1,31,outTime);1510 PS_ASSERT_INT_WITHIN_RANGE(tmTime.tm_hour,0,23,outTime);1511 PS_ASSERT_INT_WITHIN_RANGE(tmTime.tm_min,0,59,outTime);1512 PS_ASSERT_INT_WITHIN_RANGE(tmTime.tm_sec,0,59,outTime);1513 PS_ASSERT_INT_WITHIN_RANGE(millisecond,0,999,outTime);1514 1515 tmTime.tm_year -= 1900;1516 tmTime.tm_mon--;1517 tmTime.tm_isdst = -1;1518 1519 // Convert tm time to psTime1520 outTime = psTimeFromTM(&tmTime);1521 outTime->nsec = millisecond * 1000000;1522 // outTime->type = type;1523 if (type != PS_TIME_TAI) {1524 outTime = psTimeConvert(outTime, type);1525 1503 } 1526 1504 … … 1662 1640 1663 1641 struct tm tmTime; 1664 char *lastChar = strptime( (char *)s, "%EY-%m-%d%t%T", &tmTime);1642 char *lastChar = strptime(s, format, &tmTime); 1665 1643 if (!lastChar) { 1666 1644 psError(PS_ERR_UNKNOWN, true, "error parsing time string");
Note:
See TracChangeset
for help on using the changeset viewer.
