rbatis / fastdate

fastdate
Apache License 2.0
16 stars 5 forks source link

DateTime 的 set_nano 方法在 add 时是否应该是调用 Duration::from_nanos #6

Open yangbajing opened 5 months ago

yangbajing commented 5 months ago

https://github.com/rbatis/fastdate/blob/main/src/datetime.rs#L546-L553

    pub fn set_nano(mut self, nano: u32) -> Self {
        let v = self.nano();
        if nano != v {
            self = self.sub(Duration::from_nanos(v as u64));
            self = self.add(Duration::from_micros(nano as u64));
        }
        self
    }

这里在做 add 时是否应该是 self = self.add(Duration::from_nanos(nano as u64));