all repos — min @ a82d0c84bcb1727bccc1f0ab1a252d7762d1d028

A small but practical concatenative programming language.

No longer importing time module
h3rald h3rald@h3rald.com
Sat, 28 Sep 2024 21:50:09 +0200
commit

a82d0c84bcb1727bccc1f0ab1a252d7762d1d028

parent

2465db761b6bc7b668e881cce803048de678d445

M minpkg/lib/min_time.nimminpkg/lib/min_time.nim

@@ -9,13 +9,13 @@

proc time_module*(i: In) = let def = i.define() - def.symbol("timestamp") do (i: In): + def.symbol("stamp") do (i: In): i.push getTime().toUnix().newVal def.symbol("now") do (i: In): i.push epochTime().newVal - def.symbol("timeinfo") do (i: In): + def.symbol("info") do (i: In): let vals = i.expect("num") let t = vals[0] var time: Time

@@ -64,7 +64,7 @@ else:

time = t.floatVal.int64.fromUnix i.push time.utc.format("yyyy-MM-dd'T'HH:mm:ss'Z'").newVal - def.symbol("tformat") do (i: In): + def.symbol("format") do (i: In): let vals = i.expect("str", "num") let s = vals[0] let t = vals[1]
M next-release.mdnext-release.md

@@ -24,6 +24,10 @@ - **fs** module: renamed **fperms** to **fs.permissions**

- **fs** module: renamed **fsize** to **fs.size** - **fs** module: renamed **fstats** to **fs.stats** - **fs** module: renamed **ftype** to **fs.type** +- The **time** module is no longer imported. +- **time** module: renamed **tformat** to **time.format** +- **time** module: renamed **timeinfo** to **time.info** +- **time** module: renamed **timestamp** to **time.stamp**
M prelude.minprelude.min

@@ -1,6 +1,5 @@

; Imports 'dict import -'time import 'sys import 'dstore import 'crypto import
M site/contents/reference-time.mdsite/contents/reference-time.md

@@ -7,10 +7,10 @@

{#op||now||{{none}}||{{flt}}|| Returns the current time as Unix timestamp with microseconds. #} -{#op||timestamp||{{none}}||{{i}}|| +{#op||stamp||{{none}}||{{i}}|| Returns the current time as Unix timestamp. #} -{#op||timeinfo||{{i}}||{{tinfo}}|| +{#op||info||{{i}}||{{tinfo}}|| Returns a timeinfo dictionary from timestamp {{i}}. #} {#op||to-timestamp||{{tinfo}}||{{i}}||

@@ -19,10 +19,10 @@

{#op||datetime||{{i}}||{{s}}|| Returns an ISO 8601 string representing the combined date and time in UTC of timestamp {{i}}. #} -{#op||tformat||{{i}} {{s}}||{{s}}|| +{#op||format||{{i}} {{s}}||{{s}}|| > Formats timestamp {{i}} using string {{s}}. > > > %tip% > > Tip > > -> > For information on special characters in the format string, see the [format](https://nim-lang.org/docs/times.html#format,TimeInfo,string) nim method. #}+> > For information on special characters in the format string, see the [format](https://nim-lang.org/docs/times.html#format,TimeInfo,string) nim method. #}
M tests/global.mintests/global.min

@@ -127,7 +127,7 @@ ((3 >) (true))

) case ) test.assert - (time scope-symbols ("datetime" "now" "tformat" "timeinfo" "timestamp" "to-timestamp") ==) test.assert + (time scope-symbols ("datetime" "format" "info" "now" "stamp" "to-timestamp") ==) test.assert (global scope-sigils "$" in?) test.assert
M tests/time.mintests/time.min

@@ -3,19 +3,19 @@ ;;;

"time" test.describe - (timestamp 1464951736 >) test.assert + (time.stamp 1464951736 >) test.assert - (now 1464951736 >) test.assert + (time.now 1464951736 >) test.assert - (1464951736 datetime "2016-06-03T11:02:16Z" ==) test.assert + (1464951736 time.datetime "2016-06-03T11:02:16Z" ==) test.assert - (1464951736 "yy-MM-dd" tformat "16-06-03" ==) test.assert + (1464951736 "yy-MM-dd" time.format "16-06-03" ==) test.assert - (1464951736 timeinfo to-timestamp 1464951736 ==) test.assert + (1464951736 time.info time.to-timestamp 1464951736 ==) test.assert - (1464951736 timeinfo 'second dget 16 ==) test.assert + (1464951736 time.info 'second dget 16 ==) test.assert - (1464951736 timeinfo 'timezone dget integer?) test.assert + (1464951736 time.info 'timezone dget integer?) test.assert test.report stack.clear