Hi all,
I would like to get the current time as reported by gettimeofday(2) and time(2). However, neither of these functions seem to work in L4. gettimeofday() fills in the timeval struct with random values and time() always returns -1.
What is the correct way to get the time in seconds since the Epoch in L4?
Thanks in advance,
Derick
use the RTC server. $(L4DIR)/pkg/rtc.
Tiago
Hi all,
I would like to get the current time as reported by gettimeofday(2) and time(2). However, neither of these functions seem to work in L4. gettimeofday() fills in the timeval struct with random values and time() always returns -1.
What is the correct way to get the time in seconds since the Epoch in L4?
Thanks in advance,
Derick
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
On 6/8/05, Tiago João Portela Jorge tjpj@lasige.di.fc.ul.pt wrote:
use the RTC server. $(L4DIR)/pkg/rtc.
Tiago
Hi all,
I would like to get the current time as reported by gettimeofday(2) and time(2). However, neither of these functions seem to work in L4. gettimeofday() fills in the timeval struct with random values and time() always returns -1.
What is the correct way to get the time in seconds since the Epoch in L4?
Thanks in advance,
Derick
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
-- Tiago Jorge
Thanks, the RTC server is what I needed. However, I'm not sure if I'm using it correctly. As far as I can tell, in order to use time() and gettimeofday() I need to link against libdiet_be_time, but when I do I get the following error while linking:
../../../../../lib/x86_586/l4v2/libdiet_be_time.a(l4libc_init_time.o)(.text+0x20): In function `l4libc_init_time': /home/derick/DROPS/l4/pkg/rtc/lib/libc_backend/time/l4libc_init_time.c:37: undefined reference to `l4rtc_get_offset_to_realtime'
I am linking against librtc (and I'm using the l4env_freebsd mode -- maybe that is the problem).
For now I'm calling l4rtc_get_seconds_since_1970() directly.
Derick
in my case, all i had to do was to load the server. try that. no linking with its libs are needed. the RTC only reads the clock and makes its value avaliable to who wants to use it. And yes... l4env_freebsd isn't compatible with dielibc
Tiago
On 6/8/05, Tiago João Portela Jorge tjpj@lasige.di.fc.ul.pt wrote:
use the RTC server. $(L4DIR)/pkg/rtc.
Tiago
Hi all,
I would like to get the current time as reported by gettimeofday(2) and time(2). However, neither of these functions seem to work in L4. gettimeofday() fills in the timeval struct with random values and time() always returns -1.
What is the correct way to get the time in seconds since the Epoch in
L4?
Thanks in advance,
Derick
l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
-- Tiago Jorge
Thanks, the RTC server is what I needed. However, I'm not sure if I'm using it correctly. As far as I can tell, in order to use time() and gettimeofday() I need to link against libdiet_be_time, but when I do I get the following error while linking:
../../../../../lib/x86_586/l4v2/libdiet_be_time.a(l4libc_init_time.o)(.text+0x20): In function `l4libc_init_time': /home/derick/DROPS/l4/pkg/rtc/lib/libc_backend/time/l4libc_init_time.c:37: undefined reference to `l4rtc_get_offset_to_realtime'
I am linking against librtc (and I'm using the l4env_freebsd mode -- maybe that is the problem).
For now I'm calling l4rtc_get_seconds_since_1970() directly.
Derick
On Wed Jun 08, 2005 at 10:54:23 +0100, Tiago João Portela Jorge wrote:
in my case, all i had to do was to load the server. try that. no linking with its libs are needed. the RTC only reads the clock and makes its value avaliable to who wants to use it.
Just to clarify, using the time backend makes gettimeofday and co work (when using dietlibc). If you're just using the rtc interface, you of course do not need that backend.
Adam
On 6/8/05, Adam Lackorzynski adam@os.inf.tu-dresden.de wrote:
On Wed Jun 08, 2005 at 10:54:23 +0100, Tiago João Portela Jorge wrote:
in my case, all i had to do was to load the server. try that. no linking with its libs are needed. the RTC only reads the clock and makes its value avaliable to who wants to use it.
Just to clarify, using the time backend makes gettimeofday and co work (when using dietlibc). If you're just using the rtc interface, you of course do not need that backend.
When I load the RTC server it prints out the time correctly as it starts, but using time() in my program still returns -1...
Derick
On Wed Jun 08, 2005 at 17:34:38 +0200, Derick Swanepoel wrote:
On 6/8/05, Adam Lackorzynski adam@os.inf.tu-dresden.de wrote:
On Wed Jun 08, 2005 at 10:54:23 +0100, Tiago João Portela Jorge wrote:
in my case, all i had to do was to load the server. try that. no linking with its libs are needed. the RTC only reads the clock and makes its value avaliable to who wants to use it.
Just to clarify, using the time backend makes gettimeofday and co work (when using dietlibc). If you're just using the rtc interface, you of course do not need that backend.
When I load the RTC server it prints out the time correctly as it starts, but using time() in my program still returns -1...
Here's a small example that works for me:
Makefile: PKGDIR ?= ../.. L4DIR ?= $(PKGDIR)/../..
TARGET = time_test SYSTEMS = x86-l4v2 MODE = sigma0_diet DEFAULT_RELOC = 0x01000000 LIBS += -ldiet_be_time -lrtc
SRC_C = main.c
include $(L4DIR)/mk/prog.mk
main.c: #include <time.h> #include <stdio.h>
int main(void) { struct timeval tv; gettimeofday(&tv, NULL); printf("%ld, %ld.%ld\n", time(NULL), tv.tv_sec, tv.tv_usec); return 0; }
This is with dietlibc, though.
Adam
On 6/9/05, Adam Lackorzynski adam@os.inf.tu-dresden.de wrote:
On Wed Jun 08, 2005 at 17:34:38 +0200, Derick Swanepoel wrote:
On 6/8/05, Adam Lackorzynski adam@os.inf.tu-dresden.de wrote:
On Wed Jun 08, 2005 at 10:54:23 +0100, Tiago João Portela Jorge wrote:
in my case, all i had to do was to load the server. try that. no linking with its libs are needed. the RTC only reads the clock and makes its value avaliable to who wants to use it.
Just to clarify, using the time backend makes gettimeofday and co work (when using dietlibc). If you're just using the rtc interface, you of course do not need that backend.
When I load the RTC server it prints out the time correctly as it starts, but using time() in my program still returns -1...
Here's a small example that works for me:
Makefile: PKGDIR ?= ../.. L4DIR ?= $(PKGDIR)/../..
TARGET = time_test SYSTEMS = x86-l4v2 MODE = sigma0_diet DEFAULT_RELOC = 0x01000000 LIBS += -ldiet_be_time -lrtc
SRC_C = main.c
include $(L4DIR)/mk/prog.mk
main.c: #include <time.h> #include <stdio.h>
int main(void) { struct timeval tv; gettimeofday(&tv, NULL); printf("%ld, %ld.%ld\n", time(NULL), tv.tv_sec, tv.tv_usec); return 0; }
This is with dietlibc, though.
Thank you for the example, it works for me too. Unfortunately I cannot link against libdiet_be_time because I'm using the l4env_freebsd mode. I guess I won't be able to use gettimeofday()? That's OK because I can still use l4rtc_get_seconds_since_1970().
Thanks for the help,
Derick
l4-hackers@os.inf.tu-dresden.de