From dfc6d7f71b6601fa69b50dc56166c18a96e55ade Mon Sep 17 00:00:00 2001 From: Louis <contact@louiscap.co> Date: Wed, 4 Jan 2023 14:13:01 +0000 Subject: [PATCH] Add README.md --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..587c597 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Web Instant + +Provides `Spot`, a version of `Instant` that works both on desktop and the web. On desktop, the internal representation uses `std::time::Instant`. On the web, the internal representation is an `f64`, +and uses `js_sys::Date` methods to cover functinality where required + +## Install + +`cargo add web_instant` + +## Usage + +``` +use web_instant::Spot; +use std::time::Duration; + +fn my_cross_platform_timer(last_time: Spot) { + let time_diff: Duration = Spot::now() - last_time; + println!("It has been {} seconds", time_diff.as_seconds()); +} +``` -- GitLab