overdue-scratch

Author Topic: Getting the current UNIX time?  (Read 2112 times)

0 Members and 1 Guest are viewing this topic.

Stonos

  • Entrant
  • Posts: 2
Getting the current UNIX time?
« 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 :)

zef

  • Administrator
  • Posts: 265
Re: Getting the current UNIX time?
« Reply #1 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.
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

Stonos

  • Entrant
  • Posts: 2
Re: Getting the current UNIX time?
« Reply #2 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 :)
« Last Edit: January 23, 2010, 08:52:34 PM by Stonos »