]> andersk Git - moira.git/blobdiff - gen/util.c
Build shared libmoira via libtool.
[moira.git] / gen / util.c
index 9e8f2a91e0d496e0a9b2d133d21e17298f020f0a..607bf8546e5673ce78c5a2cb733fabd19545193c 100644 (file)
@@ -18,6 +18,9 @@
 
 RCSID("$Header$");
 
+/* Julian day of the UNIX epoch (January 1, 1970) */
+#define UNIX_EPOCH 2440588
+
 extern void sqlglm(char buf[], int *, int *);
 
 void fix_file(char *targetfile)
@@ -68,6 +71,17 @@ char *dequote(char *s)
   return s;
 }
 
+time_t unixtime(char *timestring)
+{
+  time_t t;
+
+  t = strtol(timestring, &timestring, 10) - UNIX_EPOCH;
+  t = t * 24 + strtol(timestring, &timestring, 10);
+  t = t * 60 + strtol(timestring, &timestring, 10);
+  t = t * 60 + strtol(timestring, &timestring, 10);
+
+  return t;
+}
 
 void db_error(int code)
 {
@@ -85,7 +99,7 @@ void db_error(int code)
   sqlglm(buf, &bufsize, &len);
   buf[len] = 0;
   com_err(whoami, 0, "SQL error text = %s", buf);
-  critical_alert("DCM", "%s build encountered DATABASE ERROR %d\n%s",
+  critical_alert(whoami, "DCM", "%s build encountered DATABASE ERROR %d\n%s",
                 whoami, code, buf);
   exit(MR_DBMS_ERR);
 }
This page took 0.108495 seconds and 4 git commands to generate.