File: instant.rs

package info (click to toggle)
rust-datetime 0.5.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: ruby: 18; makefile: 6
file content (25 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
extern crate datetime;
use datetime::Instant;


#[test]
fn seconds() {
    assert_eq!(Instant::at(3), Instant::at_ms(3, 0))
}

#[test]
fn milliseconds() {
    assert_eq!(Instant::at_ms(3, 333).milliseconds(), 333)
}

#[test]
fn epoch() {
    assert_eq!(Instant::at_epoch().seconds(), 0)
}

#[test]
fn sanity() {
    // Test that the system call has worked at all.
    // If this fails then you have gone back in time, or something?
    assert!(Instant::now().seconds() != 0)
}