update FunctionScheduler to use std::chrono::steady_clock
authorAdam Simpkins <simpkins@fb.com>
Thu, 7 May 2015 18:40:16 +0000 (11:40 -0700)
committerPraveen Kumar Ramakrishnan <praveenr@fb.com>
Tue, 12 May 2015 00:02:31 +0000 (17:02 -0700)
commitbe171a181d64a32b75440a4a2aebb7de24c4b0b1
treeca038b30eec353fc86ccff60c90ce0147c3fdc6f
parente3eecdae17dd4adc09e19da9b232f5f06846a567
update FunctionScheduler to use std::chrono::steady_clock

Summary:
Use std::chrono::steady_clock instead of clock_gettime(CLOCK_MONOTONIC).
In particular this fixes the build on Mac OS X, which doesn't have
CLOCK_MONOTONIC.

This also updates the code to use steady_clock::time_point correctly, instead
of using a raw milliseconds value for time since the epoch.

Test Plan:
Included unit tests, which were copied over from the legacy internal Facebook
(non-folly) version of this code.

Reviewed By: ldbrandy@fb.com

Subscribers: jwatzman, doug, fbcode-common-diffs@, net-systems@, exa, folly-diffs@, yfeldblum, chalfant

FB internal diff: D2051557

Signature: t1:2051557:1431019654:ee76cfcf8318cc3d8a8d1522b3fc97f08831ecf4
folly/experimental/FunctionScheduler.cpp
folly/experimental/FunctionScheduler.h
folly/experimental/test/FunctionSchedulerTest.cpp [new file with mode: 0644]