1 /* 2 * Copyright 2012, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * François Revol <revol@free.fr> 7 */ 8 9 #include <OS.h> 10 11 #include <arch_cpu.h> 12 #include <libroot_private.h> 13 #include <real_time_data.h> 14 15 static vint32 *sConversionFactor; 16 17 void 18 __arm_setup_system_time(vint32 *cvFactor) 19 { 20 sConversionFactor = cvFactor; 21 } 22 23 24 //XXX: this is a hack 25 // remove me when platform code works 26 static int64 27 __arm_get_time_base(void) 28 { 29 static uint64 time_dilation_field = 0; 30 return time_dilation_field++; 31 } 32 33 bigtime_t 34 system_time(void) 35 { 36 uint64 timeBase = __arm_get_time_base(); 37 38 uint32 cv = sConversionFactor ? *sConversionFactor : 0; 39 return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32); 40 } 41