Apply result of `update-copyright' script.
[ttfautohint.git] / src / tatime.c
blob56d04734470bf6dc4a2f8c599b42b875fdb53cf7
1 /* tatime.c */
3 /*
4 * Copyright (C) 2011-2012 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 */
22 /* make `stdint.h' define `uintXX_t' for C++ */
23 #undef __STDC_LIMIT_MACROS
24 #define __STDC_LIMIT_MACROS
26 #if HAVE_STDINT_H
27 # include <stdint.h>
28 #endif
30 #if defined UINT64_MAX || defined uint64_t
31 typedef uint64_t TA_ULongLong;
32 #else
33 # error "No unsigned 64bit wide data type found."
34 #endif
37 void
38 TA_get_current_time(FT_ULong *high,
39 FT_ULong *low)
41 /* there have been 24107 days between January 1st, 1904 (the epoch of */
42 /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */
43 TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60;
44 TA_ULongLong seconds_to_today = seconds_to_1970 + time(NULL);
47 *high = (FT_ULong)(seconds_to_today >> 32);
48 *low = (FT_ULong)seconds_to_today;
51 /* end of tatime.c */