genode/repos/os/src/test/rtc/main.cc

48 lines
1.0 KiB
C++
Raw Normal View History

/*
* \brief Test for RTC driver
* \author Christian Helmuth
* \date 2015-01-06
*/
/*
2017-01-13 13:58:21 +01:00
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
2017-01-13 13:58:21 +01:00
#include <base/component.h>
#include <base/env.h>
2017-01-13 13:58:21 +01:00
#include <base/log.h>
#include <base/printf.h>
#include <rtc_session/connection.h>
#include <timer_session/connection.h>
2017-01-13 13:58:21 +01:00
struct Main
{
2017-01-13 13:58:21 +01:00
Main(Genode::Env &env)
{
Genode::log("--- RTC test started ---");
2017-01-13 13:58:21 +01:00
/* open sessions */
Rtc::Connection rtc(env);
Timer::Connection timer(env);
2017-01-13 13:58:21 +01:00
for (unsigned i = 0; i < 4; ++i) {
Rtc::Timestamp now = rtc.current_time();
2017-01-13 13:58:21 +01:00
Genode::printf("RTC: %u-%02u-%02u %02u:%02u:%02u\n",
now.year, now.month, now.day,
now.hour, now.minute, now.second);
2017-01-13 13:58:21 +01:00
timer.msleep(1000);
}
2017-01-13 13:58:21 +01:00
Genode::log("--- RTC test finished ---");
env.parent().exit(0);
}
};
2017-01-13 13:58:21 +01:00
void Component::construct(Genode::Env &env) { static Main main(env); }