lbfgsbrs 0.1.1

Rust port of L-BFGS-B-C
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::time::{SystemTime, UNIX_EPOCH};

/// Returns the current time in seconds since the UNIX epoch
pub fn timer() -> f64 {
    match SystemTime::now().duration_since(UNIX_EPOCH) {
        Ok(duration) => {
            let seconds = duration.as_secs_f64();
            seconds
        },
        Err(_) => {
            // Handle error case (system time before UNIX epoch)
            // This is extremely unlikely but we handle it gracefully
            0.0
        }
    }
}