Set system time

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by geoff.

A PureBasic command or commands to set the system clock and system time would be convenient.

I mentioned this to you privately, Fred, but I thought it belongs on the Forum to see whether others think it would be worth your effort, or maybe tell me there is a simple alternative.

I've been using PureBasic for a few days now and I am impressed. It's easy to use and fast. I wish I'd had this years ago. Brilliant!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.

Try using Win API calls, 'SetSystemTime_(@time.SYSTEMTIME)'.
Where the variable 'time' is a structured variable that contains the time you want to set.
The structure 'SYSTEMTIME is predefined in purebasic and looks like this:

Code: Select all

Structure SYSTEMTIME
  wYear.w
  wMonth.w
  wDayOfWeek.w
  wDay.w
  wHour.w
  wMinute.w
  wSecond.w
  wMilliseconds.w
EndStructure
; No neeed for you to declare the structure above, cause, as i said, it's allready predefined by PB.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Ok, I will add this command.

Fred - AlphaSND
Post Reply