All Projects → juxt → Tick

juxt / Tick

Licence: mit
Time as a value.

Programming Languages

clojure
4091 projects

= tick

A Clojure(Script) library for dealing with time. Intended as a replacement for clj-time.

Based on Java 8 time (on the JVM) and js-joda (on JavaScript runtimes). We hope to do an implementation based on https://github.com/tc39/proposal-temporal[Temporal], when it is available.

[source,clojure]

(require '[tick.alpha.api :as t])

;; Get the current time (t/now)

See https://www.youtube.com/watch?v=UFuL-ZDoB2U[Henry Widd's talk at Clojure/North 2019] for some background

== Docs

http://juxt.pro/tick/docs/index.html[Tick Documentation]

== Status

Alpha: Ready to use with the caveat that the API might still undergo minor changes.

== Install

Get the latest from https://clojars.org/tick[Clojars] and add to your project.clj, build.boot or deps.edn.

Tick versions 0.4.24-alpha and up require minimum Clojurescript version of 1.10.741

There are some extra considerations when using tick from Clojurescript, see file docs/cljs.adoc in this repo.

Here is a one-liner to drop into a node repl with tick:


clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.741" } tick {:mvn/version "0.4.24-alpha"} }}' -m cljs.main -re node --repl

== Development

image:https://circleci.com/gh/juxt/tick/tree/master.svg?style=svg["CircleCI", link="https://circleci.com/gh/juxt/tick/tree/master"]

=== Develop The Documentation Site

Build the Cljs

make dev-docs-cljs

Build the html

make docs/index.html

Serve the docs directory and navigate to it in a browser

=== Develop Tick

Jack in with cider or equivalent method in other IDEs, and start the cljs build with:


(figwheel-start!)

And when you get a REPL you can run all the JVM tests with


(test-clj)

Or outside of the REPL run:


make test-all

which will run clojure, clojurescript (node) and clojurescript (chrome) tests. JVM tests are currently running with https://github.com/lambdaisland/kaocha[Kaocha] while JS tests are using figwheel-main and the cljs-test-runner.

As long as you have you have started your repl with these aliases "-A:dev:test-clj", you can also run backend clojure tests in the repl with something like


(require '[kaocha.repl :as kr]) (kr/run :clj)

=== npm dependencies

For running the ClojureScript tests you will need the following npm dependencies installed:


sudo npm install -g karma-cli sudo npm install -g karma sudo npm install -g karma-chrome-launcher sudo npm install -g karma-cljs-test

Check .circleci/config.yml for the versions that are known to work.

==== Setting CHROME_BIN

If you get an error similar to the following:


No binary for ChromeHeadless browser on your platform.

Set the environment variable CHROME_BIN to wherever Chrome or Chromium is installed on your platform.

=== Release

create a git tag.

make install VERSION=your-tag (this installs in ~/.m2 - check that things look ok)

make deploy VERSION=your-tag - you need to have set up clojars credentials as per https://github.com/applied-science/deps-library

git push origin new-tag-name

== Documentation

== Acknowledgements

In particular, special credit to Eric Evans for discovering Allen's interval algebra and pointing out its potential usefulness, demonstrating a working implementation of Allen's ideas in link:https://github.com/domainlanguage/time-count[his Clojure library].

Thanks also to my esteemed colleagues Patrik Kårlin for his redesign of the interval constructor function, and Henry Widd for porting to cljc.

== References

== Copyright & License

The MIT License (MIT)

Copyright © 2016-2021 JUXT LTD.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].