setting the system time

Alberto Narduzzi <[email protected]> Fri, 6 Jun 2003 17:08:56 +0200
Newsgroups gmane.comp.lang.delphi.kylix
Organization MEP S.p.A.
Message-ID <[email protected]>
Hello everybody,

I need to set the system date/time by code, what you normally do (under 
Windows env) with:

  wDT:=Frac(Now); //Save actual time only
  wDT:=wDT+EncodeDate(Year,Month,Day); //Change the date only
  DateTimeToSystemTime(wDT,wST);
  SetLocalTime(wST);

In Linux I found the function stime() from libc, defined wST as TTime_T, then 
coded what follows:

  wST:=DateTimeToFileDate(wDT);
  R:=stime(@wST);

(R is there only to see if the result, that is 0 if you are root, and -1 if 
not...)

The question is (since stime wants a PTime_T, which is a ^TTime_T, which is 
__time_t, which is (aaargh!) type LongInt) am I correct passing a ^Integer? 
(datetimetofiledate returns an integer!)
Asking this because the function did succed - I have seen my procedures 
showing the correct time after changing it - but then, after rebooting the 
system, the time went back to what it was before I did the change...
(well, I have seen this also changing the date/time in KDE, being root; and 
the changes stood there only when I changed date/time from a console, with 
date --set=...)

Any clue?

TIA
Batman


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

-------------------------------------------------------
Forum / mailing list for Borland Kylix programmers
Our web page:  http://groups.yahoo.com/group/kylixgroup
To join the forum: [email protected]
To unsubscribe:  [email protected]
To post your messages:       [email protected]
To contact the moderator:  [email protected]
------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/