DanielSant0s / AthenaEnv

A complete Javascript environment for creating homebrew applications and games on PlayStation 2.
GNU General Public License v3.0
156 stars 20 forks source link

Add millisecond precision to epoch timestamps #4

Closed jcnmsg closed 2 years ago

jcnmsg commented 2 years ago

Date.now(), performance.now() and new Date().getTime() now return a proper timestamp in milliseconds. I edited the fallback function provided by Duktape and kept referencing an external clock for the milliseconds themselves. Not sure if it's the best approach so let me know what you think.

Closes #3

To verify it's working:

Display.setVSync(true);
Font.fmLoad()

while(1){
    Display.clear(Color.new(0,0,0)) ;
    Font.fmPrint(10, 10, .5, "Milliseconds elapsed since the epoch: " + Date.now(), Color.new(255, 255, 255));
    Display.flip();
}
DanielSant0s commented 2 years ago

Looks good to me, I haven't had much time recently, I saw that you registered the issue but I couldn't find a space in my daily routine to see a way to solve it, I'm glad you took the initiative, thank you so much. Merging RN