2 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de.
3 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
4 * Distributed under the terms of the MIT License.
8 #include <libroot_private.h>
9 #include <real_time_data.h>
14 __arch_init_time(real_time_data
* data
, bool setDefaults
)
16 uint32 conversionFactor
;
17 uint64 conversionFactorNsecs
;
20 data
->arch_data
.system_time_offset
= 0;
21 data
->arch_data
.system_time_conversion_factor
= 100000;
24 // TODO: this should only store a pointer to that value
25 // When resolving this TODO, also resolve the one in the Jamfile.
27 conversionFactor
= data
->arch_data
.system_time_conversion_factor
;
28 conversionFactorNsecs
= (uint64
)conversionFactor
* 1000;
30 // The x86_64 system_time() implementation uses 64-bit multiplication and
31 // therefore shifting is not necessary for low frequencies (it's also not
32 // too likely that there'll be any x86_64 CPUs clocked under 1GHz).
33 __x86_setup_system_time((uint64
)conversionFactor
<< 32,
34 conversionFactorNsecs
);
39 __arch_get_system_time_offset(struct real_time_data
*data
)
41 //we don't use atomic_get64 because memory is read-only, maybe find another way to lock
42 return data
->arch_data
.system_time_offset
;