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. 

'Now' node returning wrong time

Hello!

I'm making a save game system in my game and I want it to keep track of the last time the player loaded the save. Sounds simple enough, but the 'Now' node in the Blueprint system is returning the wrong time.

alt text

I tested it inside the editor, standalone game and packaged project. I even tried on a different project and a different computer. Still the same two-hour difference.

Am I doing something wrong?

Thanks, Dan

Product Version: Not Selected
Tags:
now_time_node.jpg (164.7 kB)
more ▼

asked Nov 17 '14 at 10:01 PM in Blueprint Scripting

avatar image

DanZaidan
220 17 15 23

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

2 answers: sort voted first

I'm revisiting this issue now and would like to clarify the behavior. Technically, what you are seeing is correct, but it is confusing and unintuitive.

TL;DR:

s of changelist #2375426, the blueprint nodes for "As Time" and related methods will assume the timezone is unknown. The date time will be treated as UTC, but any references to the timezone in the printed time will be replaced with "Unknown". "Unknown" won't be apparent because none of the "As Time" related blueprint nodes exposes any way to override the style or time zone, yet. With this change, you will need to switch back to using "Now".

Cause

he gist of it is that "Now" is giving you an FDateTime that will give you the same year, month, day, hours, minutes, and seconds as your wall's calendar and clock. It has no concept of the time zone. When you convert that to a Unix timestamp, as "As Time" does, it's now giving you the Unix timestamp for that date and time of day as if it were UTC. IE: At what Unix timestamp would a UTC calendar and clock show this date and time of day. "As Time" then takes the timezone and applies it. The end result is what your calendar and clock would show when a calendar and clock at UTC show the same as your own does, right now. In short, you're getting double the UTC offset. I'd bet that the machine you tested on is at UTC - 2, which is why the result is a further 2 hours off from your local clock.

Solution

he blueprint nodes for "As Time" and related methods will no longer assume the local timezone, but instead will assume an "Unknown" timezone - it will print as if it were UTC, but any references to the timezone will specify "Unknown". The end result is that using "Now" and "Utc Now" will give the results you expected, in short form. If they printed in longer form, you'd see the timezone listed as "Unknown". Until the "As Time" family of blueprint nodes can have their style and time zone arguments exposed, this will help alleviate confusion.

more ▼

answered Dec 03 '14 at 11:09 PM

avatar image

[Phosphor]Sheevok STAFF
231 5 6 16

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

I'm assuming that it's getting a server time instead of local time.

Try this - alt text

help1.png (117.8 kB)
more ▼

answered Nov 18 '14 at 02:31 AM

avatar image

TSpartanT
116 17 20 26

avatar image TSpartanT Nov 18 '14 at 02:32 AM

the subtract i'm using is a "Date Time - Timespan"

avatar image TSpartanT Nov 18 '14 at 02:42 AM

How you could implement this into your game, is to have players set their " time zone" in settings.

Then instead of using just the "2" "from hours" you would get their time difference, and set up the variable "timeDifference" to correctly show the time.

avatar image TSpartanT Nov 18 '14 at 02:58 AM

Actually no this is a bug. I take that back. What you need to do is grab the "UTC now" node instead of the now node. Epic got it backwards and made "Now" grab UTC time and "UTC now" grab local time.

So yeah, just replace your "now" with "utc now" and it should work.

avatar image TJ V ♦♦ STAFF Nov 18 '14 at 03:29 PM

Hi Dan,

Thank you for the feedback. What you are seeing is not the intended functionality. I have entered this as JIRA UE-5561 in our tracking software and our developers will be looking into it further.

The workaround TSpartanT mentioned above is the best option in the meantime.

Cheers,

TJ

avatar image DanZaidan Nov 18 '14 at 04:04 PM

Thank you for your comment. I'll use the UTC time node until it is fixed.

Thanks.

(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