]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/wasm/time.rs
Add comment about the problem, and use provided path if available
[rust.git] / src / libstd / sys / wasm / time.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use fmt;
12 use time::Duration;
13
14 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
15 pub struct Instant;
16
17 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
18 pub struct SystemTime;
19
20 pub const UNIX_EPOCH: SystemTime = SystemTime;
21
22 impl Instant {
23     pub fn now() -> Instant {
24         panic!("not supported on web assembly");
25     }
26
27     pub fn sub_instant(&self, _other: &Instant) -> Duration {
28         panic!("can't sub yet");
29     }
30
31     pub fn add_duration(&self, _other: &Duration) -> Instant {
32         panic!("can't add yet");
33     }
34
35     pub fn sub_duration(&self, _other: &Duration) -> Instant {
36         panic!("can't sub yet");
37     }
38 }
39
40 impl SystemTime {
41     pub fn now() -> SystemTime {
42         panic!("not supported on web assembly");
43     }
44
45     pub fn sub_time(&self, _other: &SystemTime)
46                     -> Result<Duration, Duration> {
47         panic!()
48     }
49
50     pub fn add_duration(&self, _other: &Duration) -> SystemTime {
51         panic!()
52     }
53
54     pub fn sub_duration(&self, _other: &Duration) -> SystemTime {
55         panic!()
56     }
57 }
58
59 impl fmt::Debug for SystemTime {
60     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
61         panic!()
62     }
63 }