Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
In QuickBASIC we could manipulate the time and date of the computer.
TIME$ = "06:30:00"
DATE$ = "10/20/2020"
I see QB64 currently supports only using those two statements to get the computer time and date, and no longer to set the time and date. Do we have a Windows API call that can manipulate the computer clocks available?
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
10-25-2022, 11:02 AM
(This post was last modified: 10-25-2022, 11:05 AM by mnrvovrfc.)
On Linux is not allowed, must have "root" privilege.
This is something I never liked about Linux and their justifications for it. Right now on Windows I have to deal with a clock a few hours ahead because one of the distros I installed automatically skews the time to where it thinks is the offset from UTC. Cannot turn it off. I stopped being bothered by it.
I just noticed the forum could give me the correct time while the OS clock cannot, it's a few hours ahead. :/
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
Exactly. OS clocks can get screwed up, especially over time. Something to do with the CMOS battery age. I believe I read that somewhere years ago. Anyway, mine is 7 minutes slow. People who have this problem can use command prompt as administrator and change it. I've heard a lot of folks claim the next f'update just changes it back. Oh well.
It would be nice to SHELL the command, but I doubt that can be done in a simple way as an administrator within an app.
I was wondering if Spriggsy uses somethig like ShellExecute Windows API function and "runas."
Pete
Posts: 734
Threads: 30
Joined: Apr 2022
Reputation:
43
I have used ShellExecute with runas but not for changing time. I usually just open the Date/Time settings in Windows and change it there. But I imagine someone could do it with ShellExecute and a cmd command.
Tread on those who tread on you
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
10-25-2022, 06:43 PM
(This post was last modified: 10-25-2022, 06:44 PM by Pete.)
Thanks Spriggsy, I might give it a whirl when I get all my project windows closed. Yeah, like that day ever comes.
Pete