From aa75ec7ff317d08da508d01df0e31abe633a7475 Mon Sep 17 00:00:00 2001 From: Ivan Raikov Date: Sat, 8 Aug 2020 09:15:48 -0700 Subject: [PATCH] added units of day, week, minute [thanks to Andre Sa] --- README.md | 7 +++++-- test.scm | 3 +++ unitconv.scm | 11 +++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 91de5cb..a09ec44 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,9 @@ Defines a variable whose name is the concatenated `PREFIX` and `UNIT` and that h NameQuantityFactorAbbreviation(s) secondTime1.0(s seconds) hourTime(* sixty (* sixty second))(h hrs hours) +minuteTime(* sixty second)(minutes) +dayTime(* 24 hour)(days) +weekTime(* 7 day)(weeks) ### Units of Acceleration @@ -457,7 +460,7 @@ The following operations are available for operations on quantities with units: ## Version history - +- 3.3 : Additional units of time [Andre Sa] - 3.0 : Compatibility with CHICKEN 5 - 2.6 : Bugfixes in unit* and unit/ - 2.3 : Added definitions for centimeter and centimeter-squared @@ -478,7 +481,7 @@ The following operations are available for operations on quantities with units: ## License > -> Copyright 2007-2018 Ivan Raikov. +> Copyright 2007-2020 Ivan Raikov. > > This program is free software: you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by diff --git a/test.scm b/test.scm index 1c919ed..7321862 100644 --- a/test.scm +++ b/test.scm @@ -30,3 +30,6 @@ (print Frequency) (print (unit* millisecond hertz)) (print (quantity-int (unit-dims (unit* millisecond hertz)))) + +(print (unit-convert week second)) + diff --git a/unitconv.scm b/unitconv.scm index 0f18d59..f0f579a 100644 --- a/unitconv.scm +++ b/unitconv.scm @@ -3,7 +3,7 @@ ;; ;; TODO: implement non-strict conversion (e.g. mass <-> energy, mass <-> weight) ;; -;; Copyright 2007-2018 Ivan Raikov. +;; Copyright 2007-2020 Ivan Raikov. ;; ;; This program is free software: you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -176,6 +176,9 @@ ;; Units of time second s seconds hour h hrs hours + minute minutes + day days + week weeks ;; Units of acceleration meters-per-second-squared m/s2 m/s^2 m/sec2 m/sec^2 @@ -843,8 +846,12 @@ (define-unit atomic-mass-unit Mass 1.6605402e-27 amu atomic-mass-units) ;; Units of time -(define-unit second Time 1.0 s seconds) +(define-unit second Time 1.0 s seconds) (define-unit hour Time (* sixty (* sixty second)) h hrs hours) +(define-unit minute Time (* sixty second) minutes) +(define-unit hour Time (* sixty minute) h hrs hours) +(define-unit day Time (* 24 hour) days) +(define-unit week Time (* 7 day) weeks) ;; Units of acceleration (define-unit meters-per-second-squared Acceleration (/ meter (* second second)) m/s2 m/s^2 m/sec2 m/sec^2)