On Wed, Sep 5, 2012 at 12:32 PM, Gregory Collins <greg@gregorycollins.net> wrote:
On recent (>2009) Linux, you can call clock_gettime() with CLOCK_REALTIME_COARSE which is about 6x faster:On my workstation calling clock_gettime(CLOCK_REALTIME, ...) and poking the value into a Haskell struct takes about 70ns, with CLOCK_REALTIME_COARSE it's about 19ns (with a much lower stddev). Worth using for this application if it's available. Of course, in Snap we do the "update the clock every second in a thread" trick also.