gfc-time


License

License

Apache-style
GroupId

GroupId

com.gilt
ArtifactId

ArtifactId

gfc-time_2.12
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

gfc-time
gfc-time
Project Organization

Project Organization

com.gilt

Download gfc-time_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.gilt/gfc-time_2.12/ -->
<dependency>
    <groupId>com.gilt</groupId>
    <artifactId>gfc-time_2.12</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.gilt/gfc-time_2.12/
implementation 'com.gilt:gfc-time_2.12:0.0.7'
// https://jarcasting.com/artifacts/com.gilt/gfc-time_2.12/
implementation ("com.gilt:gfc-time_2.12:0.0.7")
'com.gilt:gfc-time_2.12:jar:0.0.7'
<dependency org="com.gilt" name="gfc-time_2.12" rev="0.0.7">
  <artifact name="gfc-time_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gilt', module='gfc-time_2.12', version='0.0.7')
)
libraryDependencies += "com.gilt" % "gfc-time_2.12" % "0.0.7"
[com.gilt/gfc-time_2.12 "0.0.7"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.0

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.0

Project Modules

There are no modules declared in this project.

gfc-time Maven Central Build Status Coverage Status Join the chat at https://gitter.im/gilt/gfc

A library that contains time related scala utility classes. Part of the Gilt Foundation Classes.

Getting gfc-time

The latest version is 0.0.7, which is cross-built against Scala 2.10.x, 2.11.x and 2.12.x.

If you're using SBT, add the following line to your build file:

libraryDependencies += "com.gilt" %% "gfc-time" % "0.0.7"

For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the gilt fundation classes.)

Contents and Example Usage

com.gilt.gfc.time.Timer

Various utilities for timing & reporting on blocks of code and scala Futures.

  • Format a nanosecond timespan into a human-readable string, like "37 us" or "45 days 08:55:01".

    val start = System.nanoTime() doSomething() val elapsed = Timer.pretty(System.nanoTime() - start) println(s"doSomething() took $elapsed")

  • Report ns result (Long value)

    val result = Timer.time(l => println(s"Operation took $l ns")) { // timed function, returning a result }

  • Report formatted result. The result String is using the best suitable time unit (e.g. "10 ns", "456 ms", "45 days 08:55:01" etc.)

    val result = Timer.time(s => println(s"Operation took ${s}")) { // timed function, returning a result }

  • Time the body, then calls pretty on the elapsed time to get a more human-friendly time String, then passes that to the "format" method.

    val result = Timer.time("Operation took %s", println _)) { // timed function, returning a result }

  • Similar functions as above are available to time scala Future completions.

com.gilt.gfc.time.Timestamp

A immutable lightweight wrapper around a millisecond timestamp.

License

Copyright 2019

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

com.gilt

Gilt Tech

Versions

Version
0.0.7