Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
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,510
Threads: 53
Joined: Jul 2022
Reputation:
47
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: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
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: 439
Threads: 17
Joined: Apr 2022
Reputation:
21
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.
Ask me about Windows API and maybe some Linux stuff
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
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