Time, CurrentTime & etc

About Monkey 2 Forums Monkey 2 Programming Help Time, CurrentTime & etc

This topic contains 4 replies, has 3 voices, and was last updated by  nerobot 2 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1632

    degac
    Participant

    Hi

    just found (thanks to Therevills) that CurrentTime() & CurrentDate() are implemented (sort of) in the Class Time.

    I have looked at the source code but I have some questions

    1

    I would implement my CurrentDate() function (ala BlitzMax, so 02 jul 2016 as returned string). As some fields are Private I can’t (without changing the main source code) create a thing like this (or I didn’t found the correct way to do it)

    I’ve hacked the CurrentDate() function in BlitzMax to use the standard Posix (I believe it’s called so) use of %d %m %Y to use them in combination

    I suspect I need to buid something for my own, no a big problem

    2.

    Looking at the source code I found this in the comment for the documentation

    Any example of this operator should work?

    3.

    And what does  mean the @hidden parameter in the #rem comment

    In the documentation there’s no reference about the fieds/properties Hour, Minutes, etc so I can think that this @hidden parameter it’s related.

    Or I’m wrong?

     

    ps: I know there is a .ToString() method and I can extract the info I need, it’s only to learn a bit MX2 code (and its limitations).

    Hi

    #1674

    Mark Sibly
    Keymaster

    Time is ‘@hidden’ because it needs more work. See my blog entry re: hidden stuff.

    In particular, I want to implement a ‘TimeSpan’ or ‘DeltaTime’ struct to go along with ‘Time’ (for use with +/- operators) but this needs a bit more thought/planning.

    So use at your own risk! The interface will probably remain much the same but the implementation could change…

    #1763

    degac
    Participant

    Thanks!

    I’ll keep track of future changes on this.

    #7609

    degac
    Participant

    How I can convert a Unix Timestamp (the value returned from GetFileTime() for example) in a ‘human ready thing’?
    I tried to toy around with Time Class, tried to convert blitzmax code to MX2, but it seems I can’t convert a Ulong to anything needed in Time.

    ps: about the Time Class I suggest
    * add some methods to convert from/to timestamp
    * make days/months public as anyone should get a ‘local’ (=in their own language) date/time
    * add STRFTIME support… it is so useful to get ‘date/time’ in the own/required string format

    Unfortunately I get stuck with type conversion between time-class & etc

    #7621

    nerobot
    Participant

    (I’ve removed previous post)

    Hm. Work with time isn’t trivial because of leap year.

    IMO, the easiest way is to extend ‘time’ module to get values directly from c++.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.