mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:06:40 +02:00
1747 add ns to duration (#2128)
* Added nanos to Duration * Removed unwraps * Added nanos to Duration * Removed unwraps * Fixed errors * Removed unwraps * Changed serialization to String * Fixed Date and Duration comparison
This commit is contained in:
committed by
GitHub
parent
6a89b1b010
commit
e07a9e4ee7
@ -18,6 +18,7 @@ nu-source = {path = "../nu-source", version = "0.16.1"}
|
||||
battery = "0.7.5"
|
||||
futures = {version = "0.3", features = ["compat", "io-compat"]}
|
||||
futures-util = "0.3.5"
|
||||
num-bigint = "0.2.6"
|
||||
|
||||
[dependencies.heim]
|
||||
default-features = false
|
||||
|
@ -4,6 +4,7 @@ use heim::{disk, host, memory, net, sensors};
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::{TaggedDictBuilder, UntaggedValue, Value};
|
||||
use nu_source::Tag;
|
||||
use num_bigint::BigInt;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
#[derive(Default)]
|
||||
@ -98,9 +99,9 @@ async fn host(tag: Tag) -> Result<Value, ShellError> {
|
||||
|
||||
// Uptime
|
||||
if let Ok(uptime) = uptime_result {
|
||||
let uptime = uptime.get::<time::second>().round() as i64;
|
||||
let uptime = uptime.get::<time::nanosecond>().round() as i64;
|
||||
|
||||
dict.insert_untagged("uptime", UntaggedValue::duration(uptime));
|
||||
dict.insert_untagged("uptime", UntaggedValue::duration(BigInt::from(uptime)));
|
||||
}
|
||||
|
||||
// Sessions
|
||||
|
Reference in New Issue
Block a user