-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #772 from candy-lang/chrono-package
Chrono package
- Loading branch information
Showing
12 changed files
with
426 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
clock := use ".clock" | ||
constants := use ".constants" | ||
duration := use ".duration" | ||
instant := use ".instant" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tag, function] = use "Core" | ||
instant = use "..instant" | ||
duration = use "..duration" | ||
|
||
is c := c % | ||
Clock f -> function.is0 f | ||
_ -> False | ||
|
||
fromSystemClock systemClock := | ||
needs (function.is0 systemClock) | ||
Clock { | ||
systemClock | function.run | duration.fromNanoseconds | instant.fromUnixDuration | ||
} | ||
|
||
mockFromInstant inst := | ||
needs (instant.is inst) | ||
Clock { instant } | ||
|
||
now clock := | ||
needs (is clock) | ||
clock | tag.getValue | function.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[int] = use "Core" | ||
|
||
daysPerNormalWeek := 7 | ||
|
||
hoursPerNormalDay := 24 | ||
hoursPerNormalWeek := hoursPerNormalDay | int.multiply daysPerNormalWeek | ||
|
||
minutesPerHour := 60 | ||
minutesPerNormalDay := minutesPerHour | int.multiply hoursPerNormalDay | ||
minutesPerNormalWeek := minutesPerNormalDay | int.multiply daysPerNormalWeek | ||
|
||
secondsPerMinute := 60 | ||
secondsPerHour := secondsPerMinute | int.multiply minutesPerHour | ||
secondsPerNormalDay := secondsPerHour | int.multiply hoursPerNormalDay | ||
secondsPerNormalWeek := secondsPerNormalDay | int.multiply daysPerNormalWeek | ||
|
||
millisecondsPerSecond := 1000 | ||
millisecondsPerMinute := millisecondsPerSecond | int.multiply secondsPerMinute | ||
millisecondsPerHour := millisecondsPerMinute | int.multiply minutesPerHour | ||
millisecondsPerNormalDay := millisecondsPerHour | int.multiply hoursPerNormalDay | ||
millisecondsPerNormalWeek := millisecondsPerNormalDay | int.multiply daysPerNormalWeek | ||
|
||
microsecondsPerMillisecond := 1000 | ||
microsecondsPerSecond := microsecondsPerMillisecond | int.multiply millisecondsPerSecond | ||
microsecondsPerMinute := microsecondsPerSecond | int.multiply secondsPerMinute | ||
microsecondsPerHour := microsecondsPerMinute | int.multiply minutesPerHour | ||
microsecondsPerNormalDay := microsecondsPerHour | int.multiply hoursPerNormalDay | ||
microsecondsPerNormalWeek := microsecondsPerNormalDay | int.multiply daysPerNormalWeek | ||
|
||
nanosecondsPerMicrosecond := 1000 | ||
nanosecondsPerMillisecond := nanosecondsPerMicrosecond | int.multiply microsecondsPerMillisecond | ||
nanosecondsPerSecond := nanosecondsPerMillisecond | int.multiply millisecondsPerSecond | ||
nanosecondsPerMinute := nanosecondsPerSecond | int.multiply secondsPerMinute | ||
nanosecondsPerHour := nanosecondsPerMinute | int.multiply minutesPerHour | ||
nanosecondsPerNormalDay := nanosecondsPerHour | int.multiply hoursPerNormalDay | ||
nanosecondsPerNormalWeek := nanosecondsPerNormalDay | int.multiply daysPerNormalWeek |
Oops, something went wrong.
d36e515
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler
Time: Compiler/hello_world
17369168
ns/iter (± 355109
)16618340
ns/iter (± 475512
)1.05
Time: Compiler/fibonacci
137159030
ns/iter (± 1001993
)132556819
ns/iter (± 837747
)1.03
Time: VM Runtime/hello_world
32486
ns/iter (± 49450
)32580
ns/iter (± 2017
)1.00
This comment was automatically generated by workflow using github-action-benchmark.