easy_utc_now
Version, currently 1.0.03 versions
- 1.0.0latestJul 19, 2024
- 0.2.0not indexedJul 19, 2024
- 0.1.0not indexedJul 19, 2024
github.com/ndudnicz/EasyUtcNow
Faster and easier way to get an utc timestamp than calling standard Time lib
3 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
easy_utc_now:
github: ndudnicz/EasyUtcNow
version: ~> 1.0.0Then run:
shards installshard.yml
- Crystal
1.13.1- License
- MIT
- Author
- ndudnicz
Dependencies
This version declares no dependencies.
README
A timestamp module
Faster and easier way to get an utc timestamp than calling standard Time lib
Installation :
Add this to your application's shard.yml:
dependencies:
easy_utc_now:
github: ndudnicz/EasyUtcNow
version: 1.0.0
Example :
require "easy_utc_now"
puts EasyUtcNow.now_utc_to_unix
API :
Static Methods Summary :
.now_utc_to_unix :
Int64
Returns the current utc epoch timestamp in second
.now_utc_to_unix_ms_f :
Float64
Returns the current utc epoch timestamp in msecond
.now_utc_to_unix_f :
Float64
Returns the current utc epoch timestamp in second as Float64
Benchmark :
$> crystal -v
Crystal 1.13.1 (2024-07-12)
LLVM: 18.1.8
Default target: aarch64-apple-darwin23.5.0
$> cd bench
$> crystal build --release bench.cr
$> ./bench
Time.utc.to_unix 71.93M ( 13.90ns) (± 1.53%) 0.0B/op 1.15× slower
EasyUtcNow.now_utc_to_unix 82.46M ( 12.13ns) (± 3.96%) 0.0B/op fastest
Time.utc.to_unix_ms 58.34M ( 17.14ns) (± 2.67%) 0.0B/op 1.41× slower
EasyUtcNow.now_utc_to_unix_ms 82.19M ( 12.17ns) (± 1.26%) 0.0B/op fastest
Time.utc.to_unix_f 72.33M ( 13.83ns) (± 1.05%) 0.0B/op 1.15× slower
EasyUtcNow.now_utc_to_unix_f 83.02M ( 12.05ns) (± 1.16%) 0.0B/op fastest
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- Jul 19, 2024
- Commit
c9f9c3190d80- Crystal
1.13.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/ndudnicz/EasyUtcNow
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 14, 2026
- Versions
- 3