test/rtc: API transition

Issue #1987
This commit is contained in:
Christian Prochaska 2017-01-13 13:58:21 +01:00 committed by Norman Feske
parent 101d0fee7c
commit 12c5982e2b

View File

@ -5,37 +5,43 @@
*/
/*
* Copyright (C) 2015 Genode Labs GmbH
* 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.
*/
#include <base/component.h>
#include <base/env.h>
#include <base/log.h>
#include <base/printf.h>
#include <rtc_session/connection.h>
#include <timer_session/connection.h>
int main(int argc, char **argv)
struct Main
{
Genode::printf("--- RTC test started ---\n");
Main(Genode::Env &env)
{
Genode::log("--- RTC test started ---");
/* open sessions */
static Rtc::Connection rtc;
static Timer::Connection timer;
/* open sessions */
Rtc::Connection rtc(env);
Timer::Connection timer(env);
for (unsigned i = 0; i < 4; ++i) {
Rtc::Timestamp now = rtc.current_time();
for (unsigned i = 0; i < 4; ++i) {
Rtc::Timestamp now = rtc.current_time();
Genode::printf("RTC: %u-%02u-%02u %02u:%02u:%02u\n",
now.year, now.month, now.day,
now.hour, now.minute, now.second);
Genode::printf("RTC: %u-%02u-%02u %02u:%02u:%02u\n",
now.year, now.month, now.day,
now.hour, now.minute, now.second);
timer.msleep(1000);
timer.msleep(1000);
}
Genode::log("--- RTC test finished ---");
env.parent().exit(0);
}
};
Genode::printf("--- RTC test finished ---\n");
return 0;
}
void Component::construct(Genode::Env &env) { static Main main(env); }