Changeset 10736
- Timestamp:
- Dec 14, 2006, 1:02:46 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psTime.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r10122 r10736 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.10 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-1 1-21 19:23:02$12 * @version $Revision: 1.107 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-12-14 23:02:46 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include "psError.h" 26 26 #include "psLogMsg.h" 27 #include "psTrace.h" 27 28 #include "psMemory.h" 28 29 #include "psAbort.h" … … 1498 1499 psTime *outTime = psTimeStrptime(input, "%Y-%m-%dT%H:%M:%S"); 1499 1500 if (!outTime) { 1500 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); 1501 return NULL; 1501 // try for date with assumed 00:00:00 time 1502 outTime = psTimeStrptime(input, "%Y-%m-%d"); 1503 if (!outTime) { 1504 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); 1505 return NULL; 1506 } 1502 1507 } 1503 1508 … … 1640 1645 PS_ASSERT_PTR_NON_NULL(format, NULL); 1641 1646 1647 double fractionalSeconds = 0.0; 1648 1642 1649 struct tm tmTime; 1650 tmTime.tm_year = tmTime.tm_mon = tmTime.tm_mday = 0; 1651 tmTime.tm_hour = tmTime.tm_min = tmTime.tm_sec = 0; 1643 1652 char *lastChar = strptime(s, format, &tmTime); 1644 1653 if (!lastChar) { … … 1648 1657 1649 1658 if (*lastChar != '\0') { 1650 psWarning("time string was not completely consumed\n"); 1659 psTrace("psLib.astrom", 3, "handling fractional second in time string\n"); 1660 // XXXXXXXXXXXXXXX 1661 // XXX this is a really stupid error: 1662 // we are dropping the fractional seconds with this conversion 1663 // I've put in a proposed fix, but PLEASE test!!! 1664 if (*lastChar == '.') { 1665 char *reallyLast; 1666 fractionalSeconds = strtod (lastChar, &reallyLast); 1667 if (!reallyLast) { 1668 psWarning("time string was not completely consumed\n"); 1669 } 1670 } 1651 1671 } 1652 1672 … … 1657 1677 } 1658 1678 1679 time->nsec += fractionalSeconds * 1e9; 1659 1680 return time; 1660 1681 }
Note:
See TracChangeset
for help on using the changeset viewer.
