Code Monkey home page Code Monkey logo

Comments (3)

uazu avatar uazu commented on May 22, 2024 1

Okay, this has been implemented in version 0.2.4. See Core::start_instant(), i.e. cx.start_instant() or whatever.

from stakker.

uazu avatar uazu commented on May 22, 2024

This got me thinking for the last couple of days. Internally the timers do use a relative time, i.e. elapsed time since runtime startup. However the only thing that is exposed is Instant. It might be more consistent to invent a new time type MonoTime which is internally like a Duration, and use that instead of Instant for most things. For simulations you could start it at zero, which means that the elapsed time is easily available. For realtime, we'd need MonoTime to be relative to some Instant. If I switched to MonoTime then that would simplify the timer code. Since I'm planning a rewrite of the timer queue at some point, it would make sense to do those changes together. This would be a breaking change, so it would be for 0.3. So that would be a cleaner longer-term change that makes all this time-handling easier. It would also be more efficient on platforms like MacOS that have awkward Instant implementations, i.e. where add/sub operations involve more complicated calculations.

However, in the meantime I can add a method to Core to get the Instant that the runtime started, so you could access it as cx.start_time(), or something similar to that.

from stakker.

TmLev avatar TmLev commented on May 22, 2024

That would be great!

from stakker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.