QB64 Phoenix Edition
Curious. Do we still have a way to change the date and time? - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2)
+--- Thread: Curious. Do we still have a way to change the date and time? (/showthread.php?tid=1006)



Curious. Do we still have a way to change the date and time? - Pete - 10-25-2022

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


RE: Curious. Do we still have a way to change the date and time? - mnrvovrfc - 10-25-2022

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. :/


RE: Curious. Do we still have a way to change the date and time? - Pete - 10-25-2022

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


RE: Curious. Do we still have a way to change the date and time? - SpriggsySpriggs - 10-25-2022

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.


RE: Curious. Do we still have a way to change the date and time? - Pete - 10-25-2022

Thanks Spriggsy, I might give it a whirl when I get all my project windows closed. Yeah, like that day ever comes.

Pete