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 //XXX: this is a hack 18 // remove me when platform code works 19 static int64 20 __sparc_get_time_base(void) 21 { 22 static uint64 time_dilation_field = 0; 23 return time_dilation_field++; 24 } 25 26 bigtime_t 27 system_time(void) 28 { 29 uint64 timeBase = __sparc_get_time_base(); 30 31 uint32 cv = sConversionFactor ? *sConversionFactor : 0; 32 return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32); 33 } 34