Jump to content


Photo

Convert real number to time


  • Please log in to reply
2 replies to this topic

#1 tomudzjeris

tomudzjeris

    GMC Member

  • GMC Member
  • 123 posts

Posted 16 October 2011 - 08:49 AM

Hello,

My game uses timer function which converts real number to local time format. It is not windows time, but the time from the start of the game. This feature works very nice if you have 23:59:59 time format. But if you are you using 11:59 AM/PM format, it shows AM or PM at the end of time. Is there a way that it always uses 23:59:59 time format and doesn't show AM or PM?

//Alarm[0] event:
global.timer += 1/(3600*24);     // Seconds increases by 1 
alarm[0] = 30;         // Reloads alarm event

//Draw event:
draw_text(560, view_yview[0]+176, string(date_time_string(global.timer)));

  • 0

#2 tomudzjeris

tomudzjeris

    GMC Member

  • GMC Member
  • 123 posts

Posted 18 October 2011 - 05:55 PM

Has anyone any ideas how to do it? I use this function for faster time retrieval, but the main problem is that it doesn't work properly if computer uses 12 hour format with PM and AM. Maybe I can write a script that somehow local system time format converts to 24 hour format. If this isn't answered then I will have to stick with a lot of timer variables and if functions...
  • 0

#3 jsorgeagames

jsorgeagames

    GMC Member

  • GMC Member
  • 620 posts
  • Version:GM8.1

Posted 18 October 2011 - 06:10 PM

I don't know if this helps but current_time is the time in milliseconds since the computer was started. So you could set a variable to current_time when the game starts and then every step set global.timer to that variable minus current_time.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users