Announcement

Collapse
No announcement yet.

Native implementation of DateTime class?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Native implementation of DateTime class?

    I have had to implement my own class for working with DateTime objects (comparing dates, determining time difference, time epoch/timestamps, etc).

    Is there nothing already available in the native code that I have missed?

    I know UE4 has the FDateTime class: https://docs.unrealengine.com/en-US/...ime/index.html

    But i don't see anything in UnrealScript.

    #2
    Are you using this?

    Code:
    local int Day, DayOfWeek, Month, Year, Hour, Minute, Second, MSecond;
    GetSystemTime(Year, Month, DayOfWeek, Day, Hour, Minute, Second, MSecond);
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    Comment


      #3
      Nathaniel3W Yes I'm aware of this (it's what I'm using in the class i implemented).

      There is no handling for comparing time objects, getting time elapsed, checking days in a given month, leap years, unix epoch timestamps. No way to perform logic operators on a DateTime objects.

      Like saying date1 < date2 for instance.

      Or checking time elapsed from date1.

      Almost all programing languages I've used provide a DateTime class, it's just weird that it's absent from US.

      What I have implemented is mostly fine. There are just a few holes in it (like not accounting for leap-years).

      Comment


        #4
        there are some macros in core folder in global.uci file at the bottom, not sure if these will help you out.

        /** This is a slick way to to do thing like: TimeSince(LastFoo) < Delta where the macro makes it a lot easier to read what the code is doing **/
        `define TimeSince(Time) (WorldInfo.TimeSeconds - `Time)
        /** This is used for classes which are object derived and do not have access to WorldInfo so we need to pass in the Actor to get a worldinfo **/
        `define TimeSinceEx(Actor,Time) (`Actor.WorldInfo.TimeSeconds - `Time)

        Comment


          #5
          Thanks gamepainters. But those are related to game time, not system DateTime.

          Comment

          Working...
          X