An alternative to ScheduledThreadPoolExecutor proof against the clock drift problem
Alternatives To Cronscheduler
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Libfaketime2,2581a month ago1February 27, 201817gpl-2.0C
libfaketime modifies the system time for a single application
16 hours ago5gpl-3.0Python
ElevenClock: Customize Windows 11 taskbar clock
Truetime Android1,304
3 days ago35apache-2.0Kotlin
Android NTP time library. Get the true current time impervious to device clock time changes
a year ago76C++
Time library for Arduino
3 months ago19otherC++
Ableton Link
Clock616135531a month ago15November 15, 202111mitGo
Clock is a small library for mocking time in Go.
Node Microtime5654,0776648 months ago39June 09, 20221mitC++
Get the current time in microseconds
116 years ago7April 28, 20162mitObjective-C
iOS library to create elegant, interactive clocks.
React Datetime Picker46392418 hours ago48September 19, 20229mitJavaScript
A datetime picker for your React app.
Literature Clock444
21 days ago3otherR
Clock using time quotes from the literature, based on the work of Jaap Meijers
Alternatives To Cronscheduler
Select To Compare

Alternative Project Comparisons

CronScheduler: a reliable Java scheduler for external interactions

Maven Central Build Status

CronScheduler is an alternative to ScheduledThreadPoolExecutor and Timer with the following advantages:

  • CronScheduler is proof against unbounded clock drift relative to UTC or system time for both one-shot or periodic tasks.
  • It takes into account machine suspension (like sleep or hibernation).
  • It has convenient methods to prevent several tasks from piling up in case of blocks, long GC pauses, or abrupt forward system time shifts (likely made by the user or the administrator of the machine).
  • It correctly handles significant system time setbacks (backward shifts), likely made by the user or the administrator of the machine.
  • It has convenient methods to schedule tasks at round times within a day in a given time zone (for example, every midnight), transparently handling all time zone and daylight saving time complexity.

See this blog post for more details and specific recommendations about when to use ScheduledThreadPoolExecutor, CronScheduler, or other scheduling facilities.





dependencies {
  compile 'io.timeandspace:cron-scheduler:0.1'

Server-side usage example:

Duration syncPeriod = Duration.ofMinutes(1);
CronScheduler cron = CronScheduler.create(syncPeriod);
cron.scheduleAtFixedRateSkippingToLatest(0, 1, TimeUnit.MINUTES, runTimeMillis -> {
    // Collect and send summary metrics to a remote monitoring system

Client-side usage example:

Duration oneHour = Duration.ofHours(1);
CronScheduler cron = CronScheduler.create(oneHour);
cron.scheduleAtRoundTimesInDaySkippingToLatest(oneHour, ZoneId.systemDefault(), runTimeMillis -> {
    notifyUser("It's time to get up and make a short break from work!");

For drop-in replacement of ScheduledThreadPoolExecutor and integration with existing code, there is an adapter: cronScheduler.asScheduledExecutorService().

See Javadocs.

Popular Clock Projects
Popular Time Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.