8000 DateTime 的 set_nano 方法在 add 时是否应该是调用 Duration::from_nanos · Issue #6 · rbatis/fastdate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
DateTime 的 set_nano 方法在 add 时是否应该是调用 Duration::from_nanos #6
Open
@yangbajing

Description

@yangbajing

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0