vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / os / arch / arm / time.c
blob9a16dedd15375b1502ec23e1a75f62789f426db1
1 /*
2 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3 * Distributed under the terms of the MIT License.
4 */
6 #include <OS.h>
8 #include <arch_cpu.h>
9 #include <libroot_private.h>
10 #include <real_time_data.h>
13 static struct arch_real_time_data *sRealTimeData;
15 void
16 __arch_init_time(struct real_time_data *data, bool setDefaults)
18 sRealTimeData = &data->arch_data;
20 if (setDefaults) {
21 sRealTimeData->data[0].system_time_offset = 0;
22 sRealTimeData->system_time_conversion_factor = 1000000000LL;
23 sRealTimeData->version = 0;
26 __arm_setup_system_time(&sRealTimeData->system_time_conversion_factor);
30 bigtime_t
31 __arch_get_system_time_offset(struct real_time_data *data)
33 int32 version;
34 bigtime_t offset;
35 do {
36 version = sRealTimeData->version;
37 offset = sRealTimeData->data[version % 2].system_time_offset;
38 } while (version != sRealTimeData->version);
40 return offset;