Index: /trunk/Ohana/src/imregister/base/misc.c
===================================================================
--- /trunk/Ohana/src/imregister/base/misc.c	(revision 2770)
+++ /trunk/Ohana/src/imregister/base/misc.c	(revision 2771)
@@ -216,4 +216,22 @@
 
 /**********/
+double sec_to_mjd (unsigned long second) {
+
+  double mjd;
+  
+  mjd = second/86400.0 + 40587.0;
+  return (mjd);
+}
+
+/**********/
+unsigned long int mjd_to_sec (double mjd) {
+
+  unsigned long int second;
+
+  second = (mjd - 40587.0)*86400;
+  return (second);
+}
+
+/**********/
 char *sec_to_date (unsigned long second) {
   
@@ -224,5 +242,5 @@
   second -= 3600*tz;
   gmt   = gmtime (&second);
-  sprintf (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); 
+  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); 
   return (line);
 
@@ -470,2 +488,33 @@
   }
 }  
+
+/* replaces whitespace blocks with single . */
+void clean_spaces (char *line) {
+
+  char *out, *in;
+
+  if (line == NULL) return;
+
+  out = in = line;
+  while (*in) {
+    if (whitespace(*in)) { 
+      *out = '.';
+      out ++;
+      in ++;
+      while (*in && whitespace(*in)) in++;
+    } else {
+      *out = *in;
+      out ++;
+      in ++;
+    }
+  }
+  *out = 0;
+  return;
+}
+
+void warn_scan (Header *header, char *field, char *format, int N, void *var) {
+  if (!fits_scan (header, field, format, N, var)) {
+    fprintf (stderr, "WARNING: %s not found in header\n", field);
+  }
+}
+
