1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2013, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2015, 2017 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2015, 2017 Cyril Roelandt <tipecaml@gmail.com>
8 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
9 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
10 ;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
11 ;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
12 ;;; Copyright © 2016, 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
13 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
14 ;;; Copyright © 2017 Nikita <nikita@n0.is>
15 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
16 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
17 ;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
18 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
19 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
20 ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
21 ;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages time)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages golang)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages terminals)
46 #:use-module (gnu packages textutils)
47 #:use-module (gnu packages)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system go)
50 #:use-module (guix build-system python)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix licenses)
54 #:use-module (guix packages))
63 (uri (string-append "mirror://gnu/time/time-"
67 "07jj7cz6lc13iqrpgn81ivqh8rkm73p4rnivwgrrshk23v4g1b7v"))))
68 (build-system gnu-build-system)
69 (home-page "https://www.gnu.org/software/time/")
70 (synopsis "Run a command, then display its resource usage")
72 "Time is a command that displays information about the resources that a
73 program uses. The display output of the program can be customized or saved
77 (define-public python-pytimeparse
79 (name "python-pytimeparse")
84 (uri (pypi-uri "pytimeparse" version))
87 "02kaambsgpjx3zi42j6l11rwms2p35b9hsk4f3kdf979gd3kcqg8"))))
89 `(("python-nose" ,python-nose)))
90 (build-system python-build-system)
91 (home-page "https://github.com/wroberts/pytimeparse")
92 (synopsis "Time expression parser")
93 (description "This small Python module parses various kinds of time
97 (define-public python-pytzdata
99 (name "python-pytzdata")
104 (uri (pypi-uri "pytzdata" version))
107 "0h0md0ldhb8ghlwjslkzh3wcj4fxg3n43bj5sghqs2m06nri7yiy"))))
108 (build-system python-build-system)
109 ;; XXX: The PyPI distribution contains no tests, and the upstream
110 ;; repository lacks a setup.py! How to build from git?
111 (arguments '(#:tests? #f))
113 `(("python-cleo" ,python-cleo)))
114 (home-page "https://github.com/sdispater/pytzdata")
115 (synopsis "Timezone database for Python")
117 "This library provides a timezone database for Python.")
120 (define-public python2-tzdata
121 (package-with-python2 python-pytzdata))
123 (define-public python-pytz
126 ;; This package should be kept in sync with tzdata in (gnu packages base).
131 (uri (pypi-uri "pytz" version))
134 "1nn459q7zg20n75akxl3ljkykgw1ydc8nb05rx1y4f5zjh4ak943"))))
135 (build-system python-build-system)
136 (home-page "http://pythonhosted.org/pytz")
137 (synopsis "Python timezone library")
138 (description "This library brings the Olson tz database into Python. It
139 allows accurate and cross platform timezone calculations using Python 2.4 or
140 higher. It also solves the issue of ambiguous times at the end of daylight
141 saving time. Almost all of the Olson timezones are supported.")
144 (define-public python2-pytz
145 (package-with-python2 python-pytz))
147 (define-public python-pendulum
149 (name "python-pendulum")
154 (uri (pypi-uri "pendulum" version))
156 (base32 "01zjc245w08j0xryrgrq9vng59q1cl5ry0hcpw5rj774pyhhqsmh"))))
157 (build-system python-build-system)
158 ;; XXX: The PyPI distribution lacks tests, and the upstream repository
160 (arguments '(#:tests? #f))
162 `(("python-dateutil" ,python-dateutil)
163 ("python-pytzdata" ,python-pytzdata)))
164 (home-page "https://github.com/sdispater/pendulum")
165 (synopsis "Alternate API for Python datetimes")
166 (description "Pendulum is a drop-in replacement for the standard
167 @{datetime} class, providing an alternative API. As it inherits from the
168 standard @code{datetime} all @code{datetime} instances can be replaced by
169 Pendulum instances.")
172 (define-public python2-pendulum
173 (package-with-python2 python-pendulum))
175 (define-public python-dateutil
177 (name "python-dateutil")
182 (uri (pypi-uri "python-dateutil" version))
185 "0g42w7k5007iv9dam6gnja2ry8ydwirh99mgdll35s12pyfzxsvk"))))
186 (build-system python-build-system)
188 `(#:phases (modify-phases %standard-phases
191 ;; Delete tests that depend on "freezegun" to avoid a
192 ;; circular dependency.
193 (delete-file "dateutil/test/test_utils.py")
194 (delete-file "dateutil/test/test_rrule.py")
196 ;; XXX: Fails to get timezone from /etc/localtime.
197 (delete-file "dateutil/test/test_tz.py")
199 (invoke "pytest" "-vv"))))))
201 `(("python-pytest" ,python-pytest)
202 ("python-pytest-cov" ,python-pytest-cov)
203 ("python-setuptools-scm" ,python-setuptools-scm)))
205 `(("python-six" ,python-six)))
206 (home-page "https://dateutil.readthedocs.io/en/stable/")
207 (synopsis "Extensions to the standard datetime module")
209 "The dateutil module provides powerful extensions to the standard
210 datetime module, available in Python 2.3+.")
211 ;; The license was changed from the three-clause BSD license to a dual
212 ;; Apache 2.0/BSD-3 variant at 2017-12-01. Some code is only available as
213 ;; BSD-3 still; but all new code is dual licensed (the user can choose).
214 (license (list bsd-3 asl2.0))))
216 (define-public python2-dateutil
217 (package-with-python2 python-dateutil))
219 (define-public python-parsedatetime
221 (name "python-parsedatetime")
226 (uri (pypi-uri "parsedatetime" version))
229 "0jxqkjks7z9dn222cqgvskp4wr6d92aglinxq7pd2w4mzdc7r09x"))))
230 (build-system python-build-system)
232 `(("python-nose" ,python-nose)
233 ("python-pyicu" ,python-pyicu)
234 ("python-pytest" ,python-pytest)
235 ("python-pytest-runner" ,python-pytest-runner)))
237 `(("python-future" ,python-future)))
238 (home-page "https://github.com/bear/parsedatetime/")
239 (synopsis "Parse human-readable date/time text")
241 "Parse human-readable date/time text.")
244 (define-public python2-parsedatetime
245 (package-with-python2 python-parsedatetime))
247 (define-public python-ciso8601
249 (name "python-ciso8601")
254 ;; The PyPi distribution doesn't include the tests.
256 (url "https://github.com/closeio/ciso8601")
257 (commit (string-append "v" version))))
258 (file-name (git-file-name name version))
261 "0g1aiyc1ayh0rnibyy416m5mmck38ksgdm3jsy0z3rxgmgb24951"))))
262 (build-system python-build-system)
263 ;; Pytz should only be required for Python 2, but the test suite fails
266 `(("python-pytz" ,python-pytz)))
267 (home-page "https://github.com/closeio/ciso8601")
269 "Fast ISO8601 date time parser")
271 "The package ciso8601 converts ISO 8601 or RFC 3339 date time strings into
272 Python datetime objects.")
275 (define-public python-tzlocal
277 (name "python-tzlocal")
282 (uri (pypi-uri "tzlocal" version))
285 "0i1fm4sl04y65qnaqki0w75j34w863gxjj8ag0vwgvaa572rfg34"))))
286 (build-system python-build-system)
289 (modify-phases %standard-phases
290 (add-before 'check 'fix-symlink-test
291 ;; see: https://github.com/regebro/tzlocal/issues/53
293 (delete-file "tests/test_data/symlink_localtime/etc/localtime")
294 (symlink "../usr/share/zoneinfo/Africa/Harare"
295 "tests/test_data/symlink_localtime/etc/localtime")
296 ;; And skip the test_fail test, it is known to fail
297 (substitute* "tests/tests.py"
298 (("def test_fail") "def _test_fail"))
301 `(("python-pytz" ,python-pytz)))
303 `(("python-mock" ,python-mock)))
304 (home-page "https://github.com/regebro/tzlocal")
305 (synopsis "Local timezone information for Python")
307 "Tzlocal returns a tzinfo object with the local timezone information.
308 This module attempts to fix a glaring hole in pytz, that there is no way to
309 get the local timezone information, unless you know the zoneinfo name, and
310 under several distributions that's hard or impossible to figure out.")
313 (define-public python-isodate
315 (name "python-isodate")
320 (uri (pypi-uri "isodate" version))
323 "1n7jkz68kk5pwni540pr5zdh99bf6ywydk1p5pdrqisrawylldif"))))
324 (build-system python-build-system)
326 `(("python-six" ,python-six)))
327 (home-page "https://github.com/gweis/isodate/")
328 (synopsis "Python date parser and formatter")
330 "Python-isodate is a python module for parsing and formatting
331 ISO 8601 dates, time and duration.")
334 (define-public python2-isodate
335 (package-with-python2 python-isodate))
337 (define-public python-iso8601
339 (name "python-iso8601")
344 (uri (pypi-uri "iso8601" version))
347 "1cgfj91khil4ii5gb8s6nxwm73vx7hqc2k79dd9d8990ylmc5ppp"))))
348 (build-system python-build-system)
350 '(#:phases (modify-phases %standard-phases
353 (invoke "pytest" "-vv" "iso8601"))))))
355 `(("python-pytest" ,python-pytest)))
356 (home-page "https://bitbucket.org/micktwomey/pyiso8601")
357 (synopsis "Module to parse ISO 8601 dates")
359 "This module parses the most common forms of ISO 8601 date strings (e.g.
360 @code{2007-01-14T20:34:22+00:00}) into @code{datetime} objects.")
363 (define-public python2-iso8601
364 (package-with-python2 python-iso8601))
366 (define-public python-monotonic
368 (name "python-monotonic")
373 (uri (pypi-uri "monotonic" version))
376 "1c6z46yb600klbfhqadyl7vq0jdjdxkm72k43ra3iw3d0xakv593"))))
377 (build-system python-build-system)
378 (arguments '(#:tests? #f)) ; no tests
379 (home-page "https://github.com/atdt/monotonic")
380 (synopsis "Implementation of time.monotonic() for Python 2 & < 3.3")
382 "This module provides a @code{monotonic()} function which returns the
383 value (in fractional seconds) of a clock which never goes backwards.")
386 (define-public python2-monotonic
387 (package-with-python2 python-monotonic))
389 (define-public python-pyrfc3339
391 (name "python-pyrfc3339")
396 (uri (pypi-uri "pyRFC3339" version))
399 "06jv7ar7lpvvk0dixzwdr3wgm0g1lipxs429s2z7knwwa7hwpf41"))))
400 (build-system python-build-system)
402 `(("python-pytz" ,python-pytz)))
404 `(("python-nose" ,python-nose)))
405 (home-page "https://github.com/kurtraschke/pyRFC3339")
406 (synopsis "Python timestamp library")
407 (description "Python library for generating and parsing RFC 3339-compliant
411 (define-public python2-pyrfc3339
412 (package-with-python2 python-pyrfc3339))
414 (define-public python-arrow
416 (name "python-arrow")
420 (uri (pypi-uri "arrow" version))
423 "1m3fpz96w3g08i9x9cpqh3cr795y9zbj1bfnay3ccdhxv86d227z"))))
424 (build-system python-build-system)
427 (modify-phases %standard-phases
430 (invoke "pytest" "-vv" "tests"
431 ;; python-dateutil doesn't recognize America/Nuuk.
432 ;; Remove when python-dateutil > 2.8.1.
433 "-k" "not test_parse_tz_name_zzz"))))))
436 ("python-chai" ,python-chai)
437 ("python-pytest" ,python-pytest)
438 ("python-pytest-cov" ,python-pytest-cov)
439 ("python-pytest-mock" ,python-pytest-mock)
440 ("python-simplejson" ,python-simplejson)))
442 `(("python-dateutil" ,python-dateutil)
443 ("python-pytz" ,python-pytz)))
444 (home-page "https://github.com/arrow-py/arrow")
445 (synopsis "Dates and times for Python")
447 "Arrow is a Python library to creating, manipulating, formatting and
448 converting dates, times, and timestamps. It implements and updates the
452 (define-public python-aniso8601
454 (name "python-aniso8601")
459 (uri (pypi-uri "aniso8601" version))
462 "1waj54iv3n3lw1fapbz8a93yjgrybgpc86wif5baxdh1arpj9df3"))))
463 (build-system python-build-system)
465 `(("python-dateutil" ,python-dateutil)))
466 (home-page "https://bitbucket.org/nielsenb/aniso8601")
467 (synopsis "Python library for parsing ISO 8601 strings")
469 "This package contains a library for parsing ISO 8601 datetime strings.")
472 (define-public python2-aniso8601
473 (package-with-python2 python-aniso8601))
475 (define-public datefudge
480 ;; Source code is available from
481 ;; <https://salsa.debian.org/debian/datefudge.git>. However,
482 ;; for bootstrapping reasons, we do not rely on 'git-fetch' here
483 ;; (since Git -> GnuTLS -> datefudge).
486 "mirror://debian/pool/main/d/datefudge/datefudge_"
490 "0ifnlb0mc8qc2kb5042pbz0ns6rwcb7201di8wyrsphl0yhnhxiv"))
491 (patches (search-patches "datefudge-gettimeofday.patch"))))
492 (build-system gnu-build-system)
494 `(#:test-target "test"
495 #:make-flags (list "CC=gcc"
496 (string-append "prefix=" (assoc-ref %outputs "out")))
498 (modify-phases %standard-phases
499 (add-after 'unpack 'patch-makefile
501 (substitute* "Makefile"
502 ((" -o root -g root") "")
503 (("VERSION := \\$\\(shell dpkg-parsechangelog .*")
504 (string-append "VERSION = " ,version)))
506 (delete 'configure))))
509 (home-page "https://salsa.debian.org/debian/datefudge")
510 (synopsis "Pretend the system date is different")
512 "Utility that fakes the system time by pre-loading a small library that
513 modifies the @code{time}, @code{gettimeofday} and @code{clock_gettime} system
517 (define-public countdown
525 (url "https://github.com/antonmedv/countdown")
526 (commit (string-append "v" version))))
527 (file-name (git-file-name name version))
529 (base32 "0pdaw1krr0bsl4amhwx03v2b02iznvwvqn7af5zp4fkzjaj14cdw"))))
530 (build-system go-build-system)
532 '(#:import-path "github.com/antonmedv/countdown"))
534 `(("runewidth" ,go-github.com-mattn-go-runewidth)
535 ("termbox" ,go-github.com-nsf-termbox-go)))
536 (home-page "https://github.com/antonmedv/countdown")
537 (synopsis "Counts to zero with a text user interface")
539 "Countdown provides a fancy text display while it counts down to zero
540 from a starting point you provide. The user can pause and resume the
541 countdown from the text user interface.")