Curious. Do we still have a way to change the date and time?
#1
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
Reply
#2
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. :/
Reply
#3
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
Reply
#4
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
Reply
#5
Thanks Spriggsy, I might give it a whirl when I get all my project windows closed. Yeah, like that day ever comes.

Pete
Reply




Users browsing this thread: 4 Guest(s)