quartz
Version, currently 0.1.02 versions
- 0.1.1latestDec 12, 2016
- 0.1.0not indexedDec 12, 2016
github.com/andrewhamon/quartz
⌚️ Crystal clear timers
5 stars
1 dependent
License: MIT
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
quartz:
github: andrewhamon/quartz
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# Quartz [](https://travis-ci.org/andrewhamon/quartz)
Dead simple timers in Crystal
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
quartz:
github: andrewhamon/quartz
version: ~> 0.1.1
```
## Usage
```crystal
require "quartz"
# Execute a block after 3 seconds
Quartz::Timer.new(3) do
puts "3 seconds"
end
# Execute block every second
Quartz::PeriodicTimer.new(1) do
puts "tick"
end
# Make sure you yield in some way so that the timers get scheduled
sleep(5)
```
## WARNING: Make sure you understand Crystal's concurrency model
Crystal is concurrent, but not (yet) parallel. Crystal fibers don't run immediately after being spawned, the main fiber must yield control, either explicitly by sleeping or implicitly by doing blocking IO.
See [the Crystal docs](https://crystal-lang.org/docs/guides/concurrency.html) for a more detailed explanation.
This has a number of consequences for timers such as this library:
- The countdown for a timer doesn't start when the timer is instantiated, only when the fiber it spawns runs. This could be an arbitrarily long time after the timer is instantiated.
- The block you pass your timer might never get called, if the main fiber terminates too early or if it never yields control.
- Different timers might fire in a different order than expected. A shorter timer could fire after a longer timer
- Timers are not precise.
- A shorter timer is not guaranteed to execute before a separate, longer timer.
## Contributing
1. Fork it ( https://github.com/andrewhamon/quartz/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request to the develop branch
## Contributors
- [andrewhamon](https://github.com/andrewhamon) Andrew Hamon - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Dec 12, 2016
- Commit
ecd00255bac1- Indexed
- not yet
Dependents
Repository
github.com/andrewhamon/quartz
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 2