Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Jan 21, 2025
1 parent 0dd9fbe commit 2c4a2ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ knitr::opts_chunk$set(
)
```

# ssdtools <img src="man/figures/logo.png" align="right" />
# hmstimer <img src="man/figures/logo.png" align="right" />

<!-- badges: start -->
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# ssdtools <img src="man/figures/logo.png" align="right" />
# hmstimer <img src="man/figures/logo.png" align="right" />

<!-- badges: start -->

Expand Down Expand Up @@ -47,34 +47,34 @@ tmr <- tmr_timer(start = TRUE, title = "my timer")

Sys.sleep(0.1)
tmr_elapsed(tmr)
#> 00:00:00.105318
#> 00:00:00.105913

Sys.sleep(0.1)
tmr_elapsed(tmr)
#> 00:00:00.212553
#> 00:00:00.215391
```

Stop the timer with `tmr_stop()`.

``` r
tmr <- tmr_stop(tmr)
tmr_elapsed(tmr)
#> 00:00:00.2237
#> 00:00:00.224024

Sys.sleep(1)
tmr_elapsed(tmr)
#> 00:00:00.2237
#> 00:00:00.224024
```

Restart the timer with `tmr_start()`.

``` r
tmr <- tmr_start(tmr)
tmr_elapsed(tmr)
#> 00:00:00.224159
#> 00:00:00.224456
Sys.sleep(0.1)
tmr_elapsed(tmr)
#> 00:00:00.33082
#> 00:00:00.331804
```

There are several options for printing and formatting including coercing
Expand All @@ -83,19 +83,19 @@ to a hms object.
``` r
tmr <- tmr_stop(tmr)
print(tmr)
#> 00:00:00.340202
#> 00:00:00.341066
tmr_print(tmr)
#> [1] "00:00:00.340202 [my timer]"
#> [1] "00:00:00.341066 [my timer]"
tmr_format(tmr, digits = 5)
#> [1] "00:00:00.34020 [my timer]"
#> [1] "00:00:00.34107 [my timer]"
```

If running `tmr_print()` behaves differently.

``` r
tmr <- tmr_start(tmr)
tmr_print(tmr)
#> [1] "00:49:50 (+00:00:01 => 00:49:51) [my timer]"
#> [1] "17:19:17 (+00:00:01 => 17:19:18) [my timer]"
```

The time for a block of code to complete can be printed using
Expand All @@ -107,7 +107,7 @@ with_timer({
Sys.sleep(0.1)
1 + 1
})
#> 00:00:00.208
#> 00:00:00.207
#> [1] 2
```

Expand Down

0 comments on commit 2c4a2ec

Please sign in to comment.