| 1 | use pracstrorust-analyzer cargo pracstro 1.1.1 crate/::{moonrust-analyzer cargo pracstro 1.1.1 moon/, solrust-analyzer cargo pracstro 1.1.1 sol/, timerust-analyzer cargo pracstro 1.1.1 time/}; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#; |
| 3 | |
| 4 | fn run_testrust-analyzer cargo pracstro 1.1.1 run_test().(name: &str, n: u32, run: fn() -> ()) { |
| 5 | let start = Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]now().(); |
| 6 | (1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n).for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|_| run()); |
| 7 | let time = start.elapsedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[Instant]elapsed().(); |
| 8 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{},{:?},{:?}", name, time /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration][`Div<u32>`]div(). n, time); |
| 9 | } |
| 10 | |
| 11 | fn mainrust-analyzer cargo pracstro 1.1.1 main().() { |
| 12 | let n = 40000; |
| 13 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Test,Mean (n={}),Full", n); |
| 14 | |
| 15 | run_testrust-analyzer cargo pracstro 1.1.1 run_test().("Control (NOP)", n, || ()); |
| 16 | run_testrust-analyzer cargo pracstro 1.1.1 run_test().("Current time", n, || { |
| 17 | timerust-analyzer cargo pracstro 1.1.1 time/::Daterust-analyzer cargo pracstro 1.1.1 time/Date#::nowrust-analyzer cargo pracstro 1.1.1 time/impl#[Date]now().(); |
| 18 | }); |
| 19 | fn ephemrust-analyzer cargo pracstro 1.1.1 ephem().() { |
| 20 | let now = timerust-analyzer cargo pracstro 1.1.1 time/::Daterust-analyzer cargo pracstro 1.1.1 time/Date#::nowrust-analyzer cargo pracstro 1.1.1 time/impl#[Date]now().(); |
| 21 | for p in solrust-analyzer cargo pracstro 1.1.1 sol/::PLANETSrust-analyzer cargo pracstro 1.1.1 sol/PLANETS. { |
| 22 | let (ra, de) = p.locationrust-analyzer cargo pracstro 1.1.1 sol/impl#[Planet]location().(now).equatorialrust-analyzer cargo pracstro 1.1.1 coord/impl#[Coord]equatorial().(); |
| 23 | (ra.clockrust-analyzer cargo pracstro 1.1.1 time/impl#[Angle]clock().(), de.to_latituderust-analyzer cargo pracstro 1.1.1 time/impl#[Angle]to_latitude().().degminsecrust-analyzer cargo pracstro 1.1.1 time/impl#[Angle]degminsec().()); |
| 24 | } |
| 25 | } |
| 26 | run_testrust-analyzer cargo pracstro 1.1.1 run_test().("Full ephemeris", n, ephemrust-analyzer cargo pracstro 1.1.1 ephem().); |
| 27 | run_testrust-analyzer cargo pracstro 1.1.1 run_test().("Moon Phase", n, || { |
| 28 | moonrust-analyzer cargo pracstro 1.1.1 moon/::MOONrust-analyzer cargo pracstro 1.1.1 moon/MOON..illumfracrust-analyzer cargo pracstro 1.1.1 moon/impl#[Moon]illumfrac().(timerust-analyzer cargo pracstro 1.1.1 time/::Daterust-analyzer cargo pracstro 1.1.1 time/Date#::nowrust-analyzer cargo pracstro 1.1.1 time/impl#[Date]now().()); |
| 29 | }); |
| 30 | } |