water 0.7.22-alpha

A Rust library that provides a thread-safe distributed message sending facility supporting synchronous and asynchronous I/O across process and machine boundaries. It also uses nets which allow message broadcasts to all, groups, or specific endpoints which eliminates the need for tons of individual channels to interconnect threads. It also provides inter-process communication using a more restricted raw message type.
1
2
3
4
5
6
7
8
9
10
11
use time::Timespec;

pub fn add(a: Timespec, b: Timespec) -> Timespec {
    let nsec = a.nsec as i64 + b.nsec as i64;
    let sectoadd = nsec / 1000000000i64;

    Timespec {
        sec:    sectoadd + a.sec + b.sec,
        nsec:   (nsec - (sectoadd * 1000000000i64)) as i32,
    }
}