Move functions related to TTC creation into separate file.
[ttfautohint.git] / src / tatime.c
blob6e2b958973ba484b4c1eecb06669936b173f5ea8
1 /* tatime.c */
3 /*
4 * Copyright (C) 2011 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
16 #include <time.h>
18 #include "ta.h"
20 /* we need an unsigned 64bit data type */
21 #if HAVE_STDINT_H
22 # include <stdint.h>
23 #endif
25 #if defined UINT64_MAX || defined uint64_t
26 typedef uint64_t TA_ULongLong;
27 #else
28 # error "No unsigned 64bit wide data type found."
29 #endif
32 void
33 TA_get_current_time(FT_ULong *high,
34 FT_ULong *low)
36 /* there have been 24107 days between January 1st, 1904 (the epoch of */
37 /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */
38 TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
39 TA_ULongLong seconds_to_today = seconds_to_1970 + time(NULL);
42 *high = (FT_ULong)(seconds_to_today >> 32);
43 *low = (FT_ULong)seconds_to_today;
46 /* end of tatime.c */