mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
comment format_julian_day()
This commit is contained in:
parent
8200b328d8
commit
fd8f629ee4
1 changed files with 4 additions and 1 deletions
|
@ -350,8 +350,11 @@ fn to_julian_day_exact(dt: &NaiveDateTime) -> f64 {
|
|||
jd_days + jd_fraction
|
||||
}
|
||||
|
||||
// Format the Julian day to a maximum of 8 decimal places. if it's an integer,
|
||||
// append `.0` to the end to stay consistent with SQLite.
|
||||
fn format_julian_day(days: f64) -> String {
|
||||
let t = (days * 100_000_000.0).round() / 100_000_000.0;
|
||||
const DECIMAL_PRECISION: f64 = 100_000_000.0;
|
||||
let t = (days * DECIMAL_PRECISION).round() / DECIMAL_PRECISION;
|
||||
let mut ret = format!("{}", t);
|
||||
if !ret.contains('.') {
|
||||
ret += ".0";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue