Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Jun 11, 2021
1 parent c9d3295 commit 7abd2ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
12 changes: 12 additions & 0 deletions crystal/examples/time/types.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
now = Time.utc
puts typeof(now)
puts now

monotonic = Time.monotonic
puts typeof(monotonic)
puts monotonic

timespan = Time::Span.new(days: 1)
puts typeof(timespan)
puts timespan

6 changes: 6 additions & 0 deletions crystal/examples/time/types.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Time
2021-06-11 10:11:22 UTC
Time::Span
27.01:20:51.929165992
Time::Span
1.00:00:00
3 changes: 0 additions & 3 deletions crystal/examples/try.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
t = Time.monotonic
puts typeof(t)

# counter = Int32|Nil

# counter = 2
Expand Down
6 changes: 6 additions & 0 deletions crystal/time.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@
![](examples/time/add_timespan.cr)
![](examples/time/add_timespan.out)

## Time Types
{id: time-types}

![](examples/time/types.cr)
![](examples/time/types.out)

0 comments on commit 7abd2ed

Please sign in to comment.