Changeset 2771
- Timestamp:
- Dec 20, 2004, 7:27:44 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/imregister/base/misc.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/base/misc.c
r14 r2771 216 216 217 217 /**********/ 218 double sec_to_mjd (unsigned long second) { 219 220 double mjd; 221 222 mjd = second/86400.0 + 40587.0; 223 return (mjd); 224 } 225 226 /**********/ 227 unsigned long int mjd_to_sec (double mjd) { 228 229 unsigned long int second; 230 231 second = (mjd - 40587.0)*86400; 232 return (second); 233 } 234 235 /**********/ 218 236 char *sec_to_date (unsigned long second) { 219 237 … … 224 242 second -= 3600*tz; 225 243 gmt = gmtime (&second); 226 s printf (line, "%4d/%02d/%02d,%02d:%02d:%02d", 1900+gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec);244 snprintf (line, 64, "%4d/%02d/%02d,%02d:%02d:%02d", 1900+gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec); 227 245 return (line); 228 246 … … 470 488 } 471 489 } 490 491 /* replaces whitespace blocks with single . */ 492 void clean_spaces (char *line) { 493 494 char *out, *in; 495 496 if (line == NULL) return; 497 498 out = in = line; 499 while (*in) { 500 if (whitespace(*in)) { 501 *out = '.'; 502 out ++; 503 in ++; 504 while (*in && whitespace(*in)) in++; 505 } else { 506 *out = *in; 507 out ++; 508 in ++; 509 } 510 } 511 *out = 0; 512 return; 513 } 514 515 void warn_scan (Header *header, char *field, char *format, int N, void *var) { 516 if (!fits_scan (header, field, format, N, var)) { 517 fprintf (stderr, "WARNING: %s not found in header\n", field); 518 } 519 } 520
Note:
See TracChangeset
for help on using the changeset viewer.
