Voodooprojects

Chameleon => General Discussion => Topic started by: Stonos on January 23, 2010, 05:10:43 PM

Title: Getting the current UNIX time?
Post by: Stonos on January 23, 2010, 05:10:43 PM
Hey,

I'm working on a small mod on Chameleon, but I need a way to get the current UNIX time.
I've tried including time.h and then calling time(), but I get an error when I try to compile:
Quote
ld_classic: Undefined symbols:
_time
collect2: ld returned 1 exit status
make[2]: *** [boot] Error 1
make[1]: *** [embedtheme] Error 2
make: *** [embedtheme] Error 2

I have also tried adding time.h to the HFILES section of Makefile but I still get the same error :(

What am I doing wrong?

Thanks :)
Title: Re: Getting the current UNIX time?
Post by: zef on January 23, 2010, 08:22:12 PM
Chameleon is a very simple preboot "OS" with its own memory layout and functions. You can only link libraries what are implemented under libsa or libsaio within the project/i386 folders. Even if you could get the time values from the CMOS, you should still need to adjust with an UTC offset.
Title: Re: Getting the current UNIX time?
Post by: Stonos on January 23, 2010, 08:50:59 PM
Aha, just what I thought :(

Any examples on how to retrieve it from the CMOS? It doesn't really have to be in the correct timezone, as long as it's changing.

The reason I need it is because I'm trying to make Chameleon use a random background each time I boot. I use a very simple way to generate "random" numbers, but I need a seed to make it work correctly. Since the time is the most used seed, I decided to go with the time, but by the looks of it, I can't (easily) use the time. Any other ideas of what else I could use as a seed?

Thanks :)