Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can you get just Hour:Minute from time()

Author
Message
Shadow Lord
22
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 19th Oct 2003 04:57
Is there a way to grab just the HH:MM from the system clock?

For those who care...

I'm textureing an object with the current time. time() returns HH:MM:SS which is more than I need. I don't want the seconds displayed. Getting the time and textureing the object is way to slow to do once per second. Doing it less often would make the seconds displayed skip several seconds.

So, once per minute I grab the time() and the do some fancy "FPS wasting" string manipulation to get me down to just HH:MM. This is 5 or ten times slower, but done 60 times less often. But when it happens, you know it. FPS crashes for a couple of seconds. I would like to speed this up if I can.

Thanks

I'm using DBPro to write "Suger Free Candyland", for diabetic children!
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 19th Oct 2003 05:08
Perhaps you could get the time() when the program starts, seperate the hours and minutes into seperate variables and get the timer() value. Then get the timer() each loop and increase the hours,minutes accordingly and use this to texture the object.
Shadow Lord
22
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 19th Oct 2003 05:13
That is a good idea, and has to be faster than my way!

Thanks.

I'm using DBPro to write "Suger Free Candyland", for diabetic children!
KOL
22
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 19th Oct 2003 05:22
Why not just do someting like this?
Shadow Lord
22
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 19th Oct 2003 06:45
I like that too... That's close to what I was doing, but shorter. I wasn't sure if Windows would pad a single digit Hour with a leading Zero. If it didn't I would have an extra : on the end. (It would seem I do the most coding during double digit hours, and too lazy to have re-set my clock to test it!)

Thanks a lot.

I'm using DBPro to write "Suger Free Candyland", for diabetic children!
KOL
22
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 19th Oct 2003 07:46 Edited at: 19th Oct 2003 07:47
Well, remember that we are in not quite in the relm of Windows with DBPro [at least in this respect] - Plus the printed help says the Get Time$ function returns time in the HH:MM:SS format anyway. We're safe as long as TGC doesn't change that on us.....

Login to post a reply

Server time is: 2026-07-26 09:30:19
Your offset time is: 2026-07-26 09:30:19