PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
rtc.c
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16#include <time.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include "ps2sdkapi.h"
20#define OSD_CONFIG_NO_LIBCDVD
21#include "osd_config.h"
22#include "timer_alarm.h"
23
24// The definition for this function is located in ee/rpc/cdvd/src/scmd.c
25extern time_t ps2time(time_t *t);
26
27s64 _ps2sdk_rtc_offset_from_busclk = 0;
28
29__attribute__((weak))
30void _libcglue_rtc_update()
31{
32 time_t rtc_sec;
33 u32 busclock_sec;
34 u32 busclock_usec;
35
36 rtc_sec = ps2time(NULL);
37 TimerBusClock2USec(GetTimerSystemTime(), &busclock_sec, &busclock_usec);
38
39 _ps2sdk_rtc_offset_from_busclk = ((s64)rtc_sec) - ((s64)busclock_sec);
40}