Babylon Native Date Time

Yo @bghgary or @Cedric

How do we deal with Date And Time… Basically i need some type of performance.now or Date.now to get the current time in milliseconds ?

1 Like

Hi @MackeyK24

Date.now() is supported. I just tried it and I get a value.
performance is not.

1 Like

Thanks… @Cedric … Luckily conditional check still works great in native babylon so i can check for window.performance … if not defined, use window.Date…

Thanks

The BABYLON.Tools.Now() checks for Performance for you, as I remember.

1 Like

Another option is to add a polyfill for performance.now. Shouldn’t be too hard to add.

1 Like

Think that should be in addition to rather than another option, though. Nobody, is going direct dev here, so it has to run on a browser too, which might have performance.

Something like:

if (!performance) {
  performance = {
    now: () => 0;
    // any other functions you need
  }
}

should provide the functionality anywhere outside the browser