Changeset 19737
- Timestamp:
- Sep 24, 2008, 10:04:32 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psTime.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r17023 r19737 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.11 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2008-0 3-17 23:53:43$12 * @version $Revision: 1.116 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2008-09-24 20:04:32 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1532 1532 psTime *outTime = psTimeStrptime(input, "%Y-%m-%dT%H:%M:%S"); 1533 1533 if (!outTime) { 1534 // Try without the middle 'T' 1535 outTime = psTimeStrptime(input, "%Y-%m-%d %H:%M:%S"); 1536 } 1537 if (!outTime) { 1534 1538 // try for date with assumed 00:00:00 time 1535 1539 outTime = psTimeStrptime(input, "%Y-%m-%d"); 1536 if (!outTime) { 1537 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); 1538 return NULL; 1539 } 1540 } 1541 if (!outTime) { 1542 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1543 _("Specified ISO Time string, '%s', is malformed. " 1544 "Must be in 'YYYY-MM-DDThh:mm:ss.sss' format."), input); 1545 return NULL; 1540 1546 } 1541 1547 … … 1742 1748 char *lastChar = strptime(s, format, &tmTime); 1743 1749 if (!lastChar) { 1744 psError(PS_ERR_UNKNOWN, true, "error parsing time string"); 1750 // No error because this function is called repeatedly as a test. 1751 // Returning NULL without an error is fine, since we're just saying that it's not readable. 1745 1752 return NULL; 1746 1753 } 1747 1754 1755 // strptime cannot handle fractional seconds, so we do that ourselves 1748 1756 if (*lastChar != '\0') { 1749 psTrace("psLib.astro", 3, "handling fractional second in time string\n");1750 // XXXXXXXXXXXXXXX1751 // XXX this is a really stupid error:1752 // we are dropping the fractional seconds with this conversion1753 // I've put in a proposed fix, but PLEASE test!!!1754 1757 if (*lastChar == '.') { 1755 char *reallyLast; 1756 fractionalSeconds = strtod (lastChar, &reallyLast);1758 char *reallyLast; // The real last part of the string 1759 fractionalSeconds = strtod(lastChar, &reallyLast); 1757 1760 if (!reallyLast) { 1758 psWarning(" time string was not completely consumed\n");1761 psWarning("Time string was not completely consumed"); 1759 1762 } 1760 1763 }
Note:
See TracChangeset
for help on using the changeset viewer.
