Changeset 6683 for trunk/Ohana/src/libohana
- Timestamp:
- Mar 26, 2006, 10:46:32 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libohana/src/time.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/src/time.c
r5926 r6683 48 48 value += tmp / 3600.0; 49 49 50 escape:50 escape: 51 51 if (neg) { 52 52 value *= -1; … … 64 64 *ra = *dec = 0; 65 65 switch (dms_to_ddd (&Ra, str1)) { 66 case 0:67 fprintf (stderr, "syntax error in RA\n");68 return (FALSE);69 case 1:70 break;71 case 2:72 Ra = Ra * 15;73 break;66 case 0: 67 fprintf (stderr, "syntax error in RA\n"); 68 return (FALSE); 69 case 1: 70 break; 71 case 2: 72 Ra = Ra * 15; 73 break; 74 74 } 75 75 switch (dms_to_ddd (&Dec, str2)) { 76 case 0:77 fprintf (stderr, "syntax error in DEC\n");78 return (FALSE);79 case 1:80 case 2:81 break;76 case 0: 77 fprintf (stderr, "syntax error in DEC\n"); 78 return (FALSE); 79 case 1: 80 case 2: 81 break; 82 82 } 83 83 *ra = Ra; … … 151 151 152 152 switch (chk_time (line)) { 153 case 0:154 return (FALSE);155 case TIME_DATE:156 *second = date_to_sec (line);157 return (TRUE);158 case TIME_DAYS:159 *second = strtod (line, 0) * 86400.0;160 return (TRUE);161 case TIME_HOURS:162 *second = strtod (line, 0) * 3600.0;163 return (TRUE);164 case TIME_MINUTES:165 *second = strtod (line, 0) * 60.0;166 return (TRUE);167 case TIME_SECONDS:168 *second = strtod (line, 0);169 return (TRUE);170 case TIME_JD:171 jd = strtod (line, 0);172 *second = jd_to_sec (jd);173 return (TRUE);174 case TIME_MJD:175 jd = strtod (line, 0);176 *second = mjd_to_sec (jd);177 return (TRUE);153 case 0: 154 return (FALSE); 155 case TIME_DATE: 156 *second = date_to_sec (line); 157 return (TRUE); 158 case TIME_DAYS: 159 *second = strtod (line, 0) * 86400.0; 160 return (TRUE); 161 case TIME_HOURS: 162 *second = strtod (line, 0) * 3600.0; 163 return (TRUE); 164 case TIME_MINUTES: 165 *second = strtod (line, 0) * 60.0; 166 return (TRUE); 167 case TIME_SECONDS: 168 *second = strtod (line, 0); 169 return (TRUE); 170 case TIME_JD: 171 jd = strtod (line, 0); 172 *second = jd_to_sec (jd); 173 return (TRUE); 174 case TIME_MJD: 175 jd = strtod (line, 0); 176 *second = mjd_to_sec (jd); 177 return (TRUE); 178 178 } 179 179 return (FALSE); … … 185 185 186 186 switch (chk_time (line)) { 187 case 0:188 case TIME_JD:189 case TIME_MJD:190 case TIME_DATE:191 return (FALSE);192 case TIME_DAYS:193 *second = strtod (line, 0) * 86400.0;194 return (TRUE);195 case TIME_HOURS:196 *second = strtod (line, 0) * 3600.0;197 return (TRUE);198 case TIME_MINUTES:199 *second = strtod (line, 0) * 60.0;200 return (TRUE);201 case TIME_SECONDS:202 *second = strtod (line, 0);203 return (TRUE);187 case 0: 188 case TIME_JD: 189 case TIME_MJD: 190 case TIME_DATE: 191 return (FALSE); 192 case TIME_DAYS: 193 *second = strtod (line, 0) * 86400.0; 194 return (TRUE); 195 case TIME_HOURS: 196 *second = strtod (line, 0) * 3600.0; 197 return (TRUE); 198 case TIME_MINUTES: 199 *second = strtod (line, 0) * 60.0; 200 return (TRUE); 201 case TIME_SECONDS: 202 *second = strtod (line, 0); 203 return (TRUE); 204 204 } 205 205 return (FALSE); … … 312 312 p1 = p2 + 1; 313 313 314 escape:314 escape: 315 315 jd = now.tm_mday - 32075 + (int)(1461*(1900 + now.tm_year + 4800 + (int)(((now.tm_mon+1)-14)/12))/4) 316 316 + (int)(367*((now.tm_mon+1) - 2 - (int)(((now.tm_mon+1) - 14)/12)*12)/12)
Note:
See TracChangeset
for help on using the changeset viewer.
