x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Elapsed milliseconds since start of level

I need to get the time in milliseconds elapsed since the start of the level.
AGameState::ElapsedTime seems to be what I'm looking for, except it delivers a time in seconds.

Is there a way to access to this in a more simple way than managing a global-ish timer as a chronometer?

Product Version: Not Selected
Tags:
more ▼

asked Feb 02 '15 at 07:09 PM in C++ Programming

avatar image

etbh
26 2 4 8

avatar image MickD777 Feb 16 '15 at 02:23 AM

Did my answer help you out?

avatar image StAnger Apr 15 '18 at 06:26 PM

Either way it helped me so thanks :D

avatar image MickD777 Apr 19 '18 at 03:50 PM

Yeah, even 3 years later :D

avatar image Compguy321 Jul 28 '18 at 12:00 AM

Is there a way to do this in Blueprint?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Yes, you can use the following :

 float realtimeSeconds = UGameplayStatics::GetRealTimeSeconds(GetWorld());

Basically, the UGameplayStatics class contains lots of neat stuff, and 2 or 3 other useful function regarding time.

If you want to get that in hours/minutes/seconds, you can use the FTimespan structure.

You can initialiaze the struct like so :

 FTimespan timeSpan = FTimespan(/*Hours*/0,/*Minutes*/0, realtimeSeconds /*Seconds*/);

Then you can use that struct to extract the time the way you want.

Hope this helps!

more ▼

answered Feb 02 '15 at 09:10 PM

avatar image

MickD777
2.1k 70 37 259

avatar image Shadowriver Apr 20 '18 at 07:26 AM

you can do it cleaner with FTimespan::FromSeconds(realtimeSeconds);

avatar image MorskoyZmey Jul 30 '18 at 12:55 PM

Also there is another way to do the same GetWorld()->GetRealTimeSeconds();. Note, that returning value is equal to such of Time node in Materials! (but check Ignore Pause in Time node!) Can be used to control animations without triggering parameters every single tick.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Also you can use

 FPlatformTime::Seconds();

It returns at least milliseconds at last microseconds

more ▼

answered Sep 21 '15 at 08:18 PM

avatar image

MorskoyZmey
377 12 159 43

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question