xref: /haiku/src/system/boot/platform/openfirmware/real_time_clock.cpp (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
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 "real_time_clock.h"
7 
8 #include <stdio.h>
9 
10 #include <boot/kernel_args.h>
11 #include <boot/stage2.h>
12 #include <platform/openfirmware/devices.h>
13 #include <platform/openfirmware/openfirmware.h>
14 
15 status_t
16 init_real_time_clock(void)
17 {
18 	// find RTC
19 	int rtcCookie = 0;
20 	if (of_get_next_device(&rtcCookie, 0, "rtc",
21 			gKernelArgs.platform_args.rtc_path,
22 			sizeof(gKernelArgs.platform_args.rtc_path)) != B_OK) {
23 		printf("init_real_time_clock(): Found no RTC device!");
24 		return B_ERROR;
25 	}
26 
27 	return B_OK;
28 }
29 
30