Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[VxW] how to get/set BIOS time?

139 views
Skip to first unread message

Qiangning Hong

unread,
Jan 4, 2004, 2:12:06 AM1/4/04
to vxwe...@csg.lbl.gov
I am using Tornado 2.0 for x86, pcPentiumpro. The function time() in
time.h returns Jan.01, 1970 after the program starts up, not the current
time found in BIOS. How can I get the BIOS time? And how to set new
time to BIOS if time adjusting is required?

Thanks in advance.

Qiangning Hong

unread,
Jan 4, 2004, 2:12:29 AM1/4/04
to vxwe...@csg.lbl.gov

Joe Durusau

unread,
Jan 4, 2004, 12:20:28 PM1/4/04
to

Consult the hardware manual for your board. The addresses to read
should be there somewhere. Use that to set the system time.

Speaking only for myself,

Joe Durusau

Vijay Peshkar

unread,
Jan 5, 2004, 3:00:41 AM1/5/04
to
Joe Durusau <durusau...@bellsouth.net> wrote in message news:<3FF84B5C...@bellsouth.net>...
Hi,
You can pick up the RTC driver code from linux and use it to get the
time from BIOS. Alternative solution would be to search this group's
archive ...must be having some code for the RTC.
bye,
Vijay

zhuoyc

unread,
Jan 5, 2004, 3:12:36 AM1/5/04
to
Qiangning Hong <luc...@tsinghua.org.cn> wrote in message news:<mailman.49.107320...@csg.lbl.gov>...

The time which you read is a default time in vxworks system starting
up.If you use standard pc architecture,bios's time has been store in
north or south bridge(I forgot it).It provide two IO address as
follow:
#define RTC_INDEX 0x70
#define RTC_DATA 0x71
you can write a number in 0x70,then read from 0x71,you can read bios's
time,and using this time which you read to set vxworks time(function
clock_settime()).after you do this step by step, you can use time's
function by vxworks lib.

sample code as follow:

void readbiostime()
{
char second,minute,......

sysOutByte (RTC_INDEX, 0);
second = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 2);
minute = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 4);
hour = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 6);
day = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 7);
date = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 8);
month = sysInByte(RTC_DATA);

sysOutByte (RTC_INDEX, 9);
year = sysInByte(RTC_DATA);
}

Set bios's time is same method,you can refer Linux's code about this
question.

Ta Hsiao

unread,
Jan 14, 2004, 12:45:54 AM1/14/04
to VxWorks Users Group List
If there is no RTC or BIOS, is it possible to produce
time/date under VxWorks?

> _______________________________________________
> VxWorks Users Group mailing list
> VxWe...@lbl.gov
> http://www-csg.lbl.gov/vxworks/

Vijay Peshkar

unread,
Jan 14, 2004, 5:45:48 AM1/14/04
to
> If there is no RTC or BIOS, is it possible to produce
> time/date under VxWorks?
Well, you can get it from BIOS or from some machine on the network
(refer rfc 867/868 etc.,).
Vijay

joe durusau

unread,
Jan 14, 2004, 7:52:34 AM1/14/04
to

Vijay Peshkar wrote:

If the OP just wants to set time time manually, he could look
at clock_settime().

0 new messages