1 /* 2 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #include <OS.h> 7 8 #include <arch_cpu.h> 9 #include <libroot_private.h> 10 #include <real_time_data.h> 11 12 13 static vint32 *sConversionFactor; 14 15 void 16 __m68k_setup_system_time(vint32 *cvFactor) 17 { 18 sConversionFactor = cvFactor; 19 } 20 21 22 //XXX: this is a hack 23 // remove me when platform code works 24 int64 25 __m68k_get_time_base(void) 26 { 27 static uint64 time_dilation_field = 0; 28 return time_dilation_field++; 29 } 30 31 bigtime_t 32 system_time(void) 33 { 34 uint64 timeBase = __m68k_get_time_base(); 35 36 uint32 cv = *sConversionFactor; 37 return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32); 38 } 39