Jump to content


Photo

High Resolution Timer


  • Please log in to reply
17 replies to this topic

#1 Yourself

Yourself

    The Ultimate Pronoun

  • GMC Elder
  • 7352 posts
  • Version:Unknown

Posted 02 March 2007 - 04:11 PM

This was actually the first creation that I converted over to an extension. But, I didn't want to make two topics in the same day, so I chose to introduce GRegex first.

Anyway, for those of you who don't know, the current_time variable in GM, while it does measure milliseconds, only gets updated about 60 times per second. So you can only really measure times to the nearest 16 ms. This is terrible resolution even if your game is only running at 30 FPS. So, this extension allows you to measure times which are accurate to the ­µs and possibly higher (it depends on the frequency of the performance counter). That's 1 millionth of a second, or 16000 times higher resolution than current_time.

Download
  • 1

#2 Quimp

Quimp

    Pretzel fanatic

  • New Member
  • 275 posts

Posted 02 March 2007 - 05:57 PM

Indeed very useful. I had planned to ask you if you could make it into an extension yesterday but I forgot to. Again, nice set of functions, thank you.
  • 0

#3 killermatt

killermatt

    GMC Member

  • New Member
  • 17 posts

Posted 05 May 2008 - 08:38 AM

binary is a data type(i think) ive got a binary watch =D
  • 0

#4 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3103 posts

Posted 10 May 2008 - 10:22 PM

Binary is a number system not a data type... LOL... Going a bit off topic...

That's like saying decimal is a data type.

Well I'm using the dll right now. I wonder if I should use the .gex instead...

Edited by Potnop, 10 May 2008 - 10:22 PM.

  • 0
Vegeta! What does the scouter say about his powerlevel?!? It's ovER 9000!!!!!
I ownt read da script, script reads me.


Link To The Super Crew Topic / Link To Colonial Commando Topic
Platform Pathfinding Example Download it here!
Editable Early Version Level Editor(Nice @$$ stuff, check it out) Download it here!

#5 tom_backton

tom_backton

    GMC Member

  • New Member
  • 226 posts

Posted 13 May 2008 - 02:09 PM

This is very useful when you want to compare different methods with the same result...I tried once and discovered current_time doesn't get updated every millisecond...
  • 0
Current Project: Warmongers (2D RTS)

You can try Warmongers Demo.

My 2 not-very-useful examples:
Snowflake Fractal
Spiral

(I have another one, growing plant with leaves and fruit LOL . . . check my last post at http://gmc.yoyogames...pic=382464&hl=)

#6 accelleon

accelleon

    GMC Member

  • New Member
  • 43 posts

Posted 14 February 2009 - 06:12 PM

how would you convert this into days, hours, minutes and seconds so that gm would display
Days: # of days
Hours: # of hours
Minutes: # of minutes
Seconds: #of seconds

or

# of days : # of hours : # of minutes : # of seconds

were the # of represents the actual number
  • 0
Go Super mega awesome smile!

#7 $pecter

$pecter

    GMC Member

  • GMC Member
  • 1616 posts
  • Version:GM8

Posted 15 February 2009 - 12:59 AM

how would you convert this into days, hours, minutes and seconds so that gm would display
Days: # of days
Hours: # of hours
Minutes: # of minutes
Seconds: #of seconds

or

# of days : # of hours : # of minutes : # of seconds

were the # of represents the actual number

Why would you need to know the time to one millionth of a second when finding the day? GM is accurate enough to measure (and even has functions to retrieve) what you want.

Edited by $pecter, 18 February 2009 - 08:38 AM.

  • 0

#8 crazynuthead9985

crazynuthead9985

    GMC Member

  • New Member
  • 3 posts

Posted 18 May 2009 - 12:58 AM

Hey. What exactly does this help with??? Thanks
  • 0

#9 posva

posva

    GMC Member

  • New Member
  • 610 posts
  • Version:GM8

Posted 20 April 2010 - 07:41 PM

by some reason, i can't install this in GM8 anymore... the matter is that i already installed it before...
  • 0

#10 accelleon

accelleon

    GMC Member

  • New Member
  • 43 posts

Posted 11 May 2010 - 10:31 AM

i don't know what is wrong but it seems that the hrt_marker_delta() function doesn't work sometimes.....

i'm using this extension for my media player and when i first hit play it tells me how long my computer has been on but if i pause it and then play it again it goes to normal.

the only functions i call from this extension are (exactly how i have them in code)
hrt_marker_add()
hrt_marker_set(marker,1,0)
hrt_marker_set(marker,lasttime,0) //lasttime is the last reported time before pausing
hrt_marker_delta(marker)

and yes im positive that hrt_marker_delta is what going wrong here
  • 0
Go Super mega awesome smile!

#11 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 17 June 2010 - 07:40 PM

This is really handy, thanks a lot.
  • 0

#12 dll1024

dll1024

    GMC Member

  • GMC Member
  • 9 posts

Posted 10 September 2011 - 10:07 AM

it doesnt load on my game maker 8
does it work on game maker8?

can you give dll or gml file?
  • 0
Posted Image

#13 MuriloBeraldo

MuriloBeraldo

    GMC Member

  • GMC Member
  • 29 posts
  • Version:GM:Studio

Posted 31 March 2014 - 03:52 AM

Could anybody help me on how to use it?

 

I'm quite a newbie with extensions and would love any documentation or help with  this one XD

 

Thanks a lot


  • 0

#14 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 31 March 2014 - 06:34 AM

if you're using GM Studio - you don't need it. Studio have built-in variable delta_time, that do exacly same thing.

I use it like this:

delta = .00006*delta_time;

That will return 1 when you have exactly 60 FPS, 2 when 30 FPS etc.


  • 0

#15 rwkay

rwkay

    YoYo Games CTO

  • YoYo Games Staff
  • 2937 posts
  • Version:Unknown

Posted 31 March 2014 - 11:20 AM

Studio also has get_timer() which is a microsecond accurate timer - this is supported cross platform.

 

Russell


  • 0

#16 MuriloBeraldo

MuriloBeraldo

    GMC Member

  • GMC Member
  • 29 posts
  • Version:GM:Studio

Posted 01 April 2014 - 01:10 AM

Thanks guys.

 

 

I'm making a rhythm game and I'm trying to fix the sync problem of the music when the game lags/drops framerate.

 

I'm using a Timeline to spawn the  arrows/notes that the player must hit at the right time. delta_time should fix the problem when the game drops framerate?

 

link to the topic that I'm seeking help with that with more info about the game : http://gmc.yoyogames...howtopic=616688


  • 0

#17 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 01 April 2014 - 03:33 AM

Studio also has get_timer() which is a microsecond accurate timer - this is supported cross platform.
 
Russell


Well some platforms the value of get_timer() is rounded to the nearest millisec unless that has been fixed?

Edited by icuurd12b42, 01 April 2014 - 03:33 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#18 JonG476

JonG476

    GMC Member

  • New Member
  • 1 posts
  • Version:Unknown

Posted 22 January 2015 - 08:20 PM

Awesome man, thanks! :D

 

This is a great example for making a metronome or a music game. I'm making one similar to Rez.


  • 0