summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/server.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/server.rs b/src/bin/server.rs
index 708cd3e..9ea1f0d 100644
--- a/src/bin/server.rs
+++ b/src/bin/server.rs
@@ -7,7 +7,7 @@ use std::collections::HashMap;
use std::io::Write;
use std::net::TcpListener;
use std::thread::{sleep, spawn};
-use std::time::{Duration, Instant};
+use std::time::{Duration, Instant, SystemTime};
use space::constants;
use space::mass::{Mass, MassEntry};
@@ -28,8 +28,9 @@ fn populate() -> HashMap<String, Mass> {
fn backup(masses: HashMap<String, Mass>) {
let connection = PgConnection::establish(&get_db_url()).expect("Cannot connect");
+ let timestamp = SystemTime::now();
for (name, mass) in masses {
- let mass_entry = mass.to_mass_entry(name.to_string());
+ let mass_entry = mass.to_mass_entry(name.to_string(), timestamp);
diesel::insert_into(db_masses)
.values(&mass_entry)
.on_conflict(name_column)