Menu

#2299 getWiiTime in playlog.c is unnecessary

New
nobody
None
Medium
Defect
2015-05-10
2015-01-04
Anonymous
No

Originally created by: antidote.crk@gmail.com

Simply using extern u64 gettime() will get you a more accurate result.
Minimum example:
http://pastebin.com/WSPh7mQv

Discussion

  • Anonymous

    Anonymous - 2015-01-04

    Originally posted by: antidote.crk@gmail.com

    I've created a PR on libogc which adds SYS_Time(), which would simplify such tasks as GC Save and play_rec.dat manipulation.

    https://github.com/devkitPro/libogc/pull/1

     
  • Anonymous

    Anonymous - 2015-03-22

    Originally posted by: c...@mangaheart.org

    I tested SYS_Time() function (like you did on libogc patch) but it doesn't return the same value than getWiiTime().
    The value is much smaller and is neither ticks nor seconds since 2000.
    I'm not sure if I did something wrong, so I compiled your example and both functions return different values.

    I didn't test to launch a game with playlog setting enabled, but suppose it won't work.
    Playlog works fine with the game launch time returned by getWiiTime().
    I can't use a smaller value or it would think the user played 24h+ (or kept the game running for months/years) when comparing launch time and exit time.

    Though, gettime() is good to compare function execution time ;)

     
  • Cyan

    Cyan - 2015-05-10

    I'm posting the reply here (original on googlecode)

    Strange, it was working fine on my wii, as well as in Dolphin. :/
    Mind posting the code you used originally? I'd like to compare and see if I may have messed up somewhere.
    Hmm, I just tested, I think what's happening is there is some weird rounding going on. SYS_Time is working properly in Dolphin and on my wii.

    On top of that, depending on which order you call them in one is always going to be slightly behind the other. I swapped the order, and getWiiTime was smaller than SYS_Time instead of larger.

    AH, I figured it out, if you look at the following code listing, you'll notice that libogc doing exactly what my SYS_Time function is doing as well as adding time to return the time since epoch value 946684800. But it's also having to round because time_t isn't a u64, it's a u32 http://pastebin.com/6hS45v9D and from machine/types.h: #define TIME_T long / time() /

     

Log in to post a comment.