X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/7ac48069b111a991ee5975cb6088c4563b57b670..30e8d306df648a457ba510d246ff3d2f9b8057bd:/gen/util.c diff --git a/gen/util.c b/gen/util.c index 9e8f2a91..d56ea3b2 100644 --- a/gen/util.c +++ b/gen/util.c @@ -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, ×tring, 10) - UNIX_EPOCH; + t = t * 24 + strtol(timestring, ×tring, 10); + t = t * 60 + strtol(timestring, ×tring, 10); + t = t * 60 + strtol(timestring, ×tring, 10); + + return t; +} void db_error(int code) {