2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
12 * The TOD hardware adds 1 to the 51st bit every microsecond
13 * The timer hardware subtracts 1 from the 51st bit every microsecond
15 #define CLK_MICROSEC 0x1000UL
16 #define CLK_SEC 0xf4240000ULL
17 #define CLK_MIN 0x3938700000ULL
18 #define CLK_HOUR 0xd693a400000ULL
19 #define CLK_DAY 0x141dd76000000ULL
20 #define CLK_YEAR 0x1cae8c13e000000ULL
21 #define CLK_FOURYEARS 0x72ce4e26e000000ULL
29 extern struct datetime
*parse_tod(struct datetime
*dt
, u64 tod
);
31 static inline int get_tod(u64
*tod
)
38 * STCKF was added to the z9, and therefore generates a
39 * operation exception on any pre-z9 hardware.
41 * GNU as doesn't like stckf mnemonic, so let's just invoke
44 ".insn s,0xb27c0000,%0\n"
61 static inline int get_parsed_tod(struct datetime
*dt
)
73 static inline int leap_year(int year
)
75 return (year
% 4 == 0) && (year
% 100 != 0 || year
% 400 == 0);