dcerpc-nt: add UNION_ALIGN_TO... helpers
[wireshark-sm.git] / wsutil / epochs.h
blob27a884737e018d223453a4be6b9a46752e75749d
1 /** @file
3 * Definitions of epoch values for various absolute time types.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 2006 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __EPOCHS_H__
13 #define __EPOCHS_H__
15 #include <glib.h>
18 * Deltas between the epochs for various non-UN*X time stamp formats and
19 * the January 1, 1970, 00:00:00 (proleptic?) UTC epoch for the UN*X time
20 * stamp format.
24 * 1900-01-01 00:00:00 (proleptic?) UTC.
25 * Used by a number of time formats.
27 #define EPOCH_DELTA_1900_01_01_00_00_00_UTC 2208988800U
30 * 1904-01-01 00:00:00 (proleptic?) UTC.
31 * Used in the classic Mac OS, and by formats, such as MPEG-4 Part 14 (MP4),
32 * which is based on Apple's QuickTime format.
34 #define EPOCH_DELTA_1904_01_01_00_00_00_UTC 2082844800U
37 * 1601-01-01 (proleptic Gregorian) 00:00:00 (proleptic?) UTC.
38 * The Windows NT epoch, used in a number of places, as it is
39 * the start of a 400 year Gregorian cycle.
41 * This is
43 * 369*365.25*24*60*60-(3*24*60*60+6*60*60)
45 * or equivalently,
47 * (89*4*365.25+(3*4+1)*365)*24*60*60
49 * 1970-1601 is 369; 365.25 is the average length of a year in days,
50 * including leap years.
52 * 369 = 4*92 + 1, so there are 92 groups of 4 consecutive years plus
53 * one leftover year, 1969, with 365 days.
55 * All but three of the groups of 4 consecutive years average 365.25 days
56 * per year, as they have one leap year in the group. However, 1700, 1800,
57 * and 1900 were not leap years, as, while they're all evenly divisible by 4,
58 * they're also evenly divisible by 100, but not evenly divisible by 400.
60 * So we have 89 groups of 4 consecutive years that average 365.25
61 * days per year, 3 groups of 4 consecutive years that average 365 days
62 * (as they lack a leap year), and one leftover year, 1969, that is
63 * 365 days long.
65 #define EPOCH_DELTA_1601_01_01_00_00_00_UTC UINT64_C(11644473600)
68 * 2000-01-01 00:00:00 UTC.
69 * Used by the Zigbee Zigbee Cluster Library protocol.
71 #define EPOCH_DELTA_2000_01_01_00_00_00_UTC ((unsigned)(((3*365 + 366)*7 + 2*365)*24*3600))
73 #endif /* __EPOCHS_H__ */