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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pub use crate::clock::Clock;
use crate::{
account::Account,
clock::{Epoch, Segment, Slot},
sysvar::Sysvar,
};
crate::declare_sysvar_id!("SysvarC1ock11111111111111111111111111111111", Clock);
impl Sysvar for Clock {}
pub fn create_account(
lamports: u64,
slot: Slot,
segment: Segment,
epoch: Epoch,
leader_schedule_epoch: Epoch,
) -> Account {
Clock {
slot,
segment,
epoch,
leader_schedule_epoch,
}
.create_account(lamports)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_new() {
let account = create_account(1, 0, 0, 0, 0);
let clock = Clock::from_account(&account).unwrap();
assert_eq!(clock, Clock::default());
}
}