Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

C# XNA: How Do I get the Current Time in Milliseconds

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 jdub   Members   

459
Like
0Likes
Like

Posted 25 March 2008 - 12:52 PM

I'm making a game in C# using XNA and I was wondering how you retrieve the current Time in Milliseconds. DateTime.Now.Millisecond isn't working for me as it doesn't return the full date in milliseconds.

#2 TheUnbeliever   Members   

963
Like
0Likes
Like

Posted 25 March 2008 - 01:11 PM

Milliseconds from when? The beginning of the year 1AD?

#3 Trillian   Members   

410
Like
0Likes
Like

Posted 25 March 2008 - 01:42 PM

For game programming purposes, DateTime.Now.Ticks should be of interest to you. (If you need miliseconds, just divide that number by 10000, if I'm not mistaking).

Quote:
From MSDN:
A single tick represents one hundred nanoseconds or one ten-millionth of a second. The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001, which represents DateTime.MinValue.


#4 Chaotic_Attractor   Members   

152
Like
0Likes
Like

Posted 25 March 2008 - 01:53 PM

System.Environment.TickCount will give you the number of milliseconds that have elapsed since the start of the application.

#5 typedef struct   Members   

234
Like
0Likes
Like

Posted 25 March 2008 - 04:44 PM

GameTime.TotalGameTime.TotalMilliseconds is the milliseconds since the game started.

GameTime.ElapsedGameTime.TotalMilliseconds is the milliseconds since the last frame.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.