github.com/paketo-buildpacks/packit@v1.3.2-0.20211206231111-86b75c657449/chronos/doc.go (about)

     1  // Package chronos provides clock functionality that can be useful when
     2  // developing and testing Cloud Native Buildpacks.
     3  //
     4  // Below is an example showing how you might use a Clock to measure the
     5  // duration of an operation:
     6  //
     7  //   package main
     8  //
     9  //   import (
    10  //   	"os"
    11  //
    12  //   	"github.com/paketo-buildpacks/packit/chronos"
    13  //   )
    14  //
    15  //   func main() {
    16  //   	duration, err := chronos.DefaultClock.Measure(func() error {
    17  //      // Perform some operation, like sleep for 10 seconds
    18  //      time.Sleep(10 * time.Second)
    19  //
    20  //      return nil
    21  //    })
    22  //   	if err != nil {
    23  //   		panic(err)
    24  //   	}
    25  //
    26  //    fmt.Printf("duration: %s", duration)
    27  //   	// Output: duration: 10s
    28  //   }
    29  //
    30  package chronos