aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/time/instant.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/time/instant.lux')
-rw-r--r--stdlib/source/lux/time/instant.lux36
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index 018eeb936..c4d3c6fdf 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -97,8 +97,8 @@
(if (i/= 0 (duration.query year time-left))
[reference time-left]
(if (duration/>= duration.empty time-left)
- (recur (i/inc reference) (duration.merge (duration.scale -1 year) time-left))
- (recur (i/dec reference) (duration.merge year time-left)))
+ (recur (inc reference) (duration.merge (duration.scale -1 year) time-left))
+ (recur (dec reference) (duration.merge year time-left)))
))))
(def: normal-months
@@ -110,23 +110,23 @@
(def: leap-year-months
(Sequence Nat)
- (sequence.update [+1] n/inc normal-months))
+ (sequence.update [+1] inc normal-months))
(def: (find-month months time)
(-> (Sequence Nat) duration.Duration [Nat duration.Duration])
(if (duration/>= duration.empty time)
(sequence/fold (function (_ month-days [current-month time-left])
- (let [month-duration (duration.scale (nat-to-int month-days) duration.day)]
+ (let [month-duration (duration.scale (.int month-days) duration.day)]
(if (i/= 0 (duration.query month-duration time-left))
[current-month time-left]
- [(n/inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)])))
+ [(inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)])))
[+0 time]
months)
(sequence/fold (function (_ month-days [current-month time-left])
- (let [month-duration (duration.scale (nat-to-int month-days) duration.day)]
+ (let [month-duration (duration.scale (.int month-days) duration.day)]
(if (i/= 0 (duration.query month-duration time-left))
[current-month time-left]
- [(n/dec current-month) (duration.merge month-duration time-left)])))
+ [(dec current-month) (duration.merge month-duration time-left)])))
[+11 time]
(sequence.reverse months))))
@@ -176,7 +176,7 @@
day-time (duration.frame duration.day offset)
days-of-year (if (duration/>= duration.empty day-time)
days-of-year
- (i/dec days-of-year))
+ (dec days-of-year))
mp (|> days-of-year (i/* 5) (i/+ 2) (i// 153))
day (|> days-of-year
(i/- (|> mp (i/* 153) (i/+ 2) (i// 5)))
@@ -186,7 +186,7 @@
3
-9)))
year (if (i/<= 2 month)
- (i/inc year)
+ (inc year)
year)]
[[year month day]
day-time]))
@@ -251,13 +251,13 @@
leap-year-months
normal-months)
month-days (|> months
- (sequence.nth (int-to-nat (i/dec utc-month)))
+ (sequence.nth (.nat (dec utc-month)))
maybe.assume)]
_ (l.this "-")
utc-day lex-section
_ (p.assert "Invalid day."
(and (i/>= 1 utc-day)
- (i/<= (nat-to-int month-days) utc-day)))
+ (i/<= (.int month-days) utc-day)))
_ (l.this "T")
utc-hour lex-section
_ (p.assert "Invalid hour."
@@ -277,16 +277,16 @@
_ (l.this "Z")
#let [years-since-epoch (i/- epoch-year utc-year)
previous-leap-days (i/- (leap-years epoch-year)
- (leap-years (i/dec utc-year)))
+ (leap-years (dec utc-year)))
year-days-so-far (|> (i/* 365 years-since-epoch)
(i/+ previous-leap-days))
month-days-so-far (|> months
sequence.to-list
- (list.take (int-to-nat (i/dec utc-month)))
+ (list.take (.nat (dec utc-month)))
(L/fold n/+ +0))
total-days (|> year-days-so-far
- (i/+ (nat-to-int month-days-so-far))
- (i/+ (i/dec utc-day)))]]
+ (i/+ (.int month-days-so-far))
+ (i/+ (dec utc-day)))]]
(wrap (|> epoch
(shift (duration.scale total-days duration.day))
(shift (duration.scale utc-hour duration.hour))
@@ -314,7 +314,7 @@
(-> Instant date.Date)
(let [[[year month day] _] (extract-date instant)]
{#date.year year
- #date.month (case (i/dec month)
+ #date.month (case (dec month)
0 #date.January
1 #date.February
2 #date.March
@@ -328,7 +328,7 @@
10 #date.November
11 #date.December
_ (undefined))
- #date.day (int-to-nat day)}))
+ #date.day (.nat day)}))
(def: #export (month instant)
(-> Instant date.Month)
@@ -342,7 +342,7 @@
day-time (duration.frame duration.day offset)
days (if (and (duration.negative? offset)
(not (duration.neutral? day-time)))
- (i/dec days)
+ (dec days)
days)
## 1970/01/01 was a Thursday
y1970m0d0 4]