blob: 4223337fbf940e0f2f513c5ea33c6bcfe37f2c73 (
plain)
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
|
/* Copyright 2013--2016 The Tor Project
* See LICENSE for licensing information */
package org.torproject.onionoo.docs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UpdateStatus extends Document {
private static Logger log = LoggerFactory.getLogger(UpdateStatus.class);
private long updatedMillis;
public void setUpdatedMillis(long updatedMillis) {
this.updatedMillis = updatedMillis;
}
public long getUpdatedMillis() {
return this.updatedMillis;
}
@Override
public void setFromDocumentString(String documentString) {
try {
this.updatedMillis = Long.parseLong(documentString.trim());
} catch (NumberFormatException e) {
log.error("Could not parse timestamp '" + documentString + "'. "
+ "Setting to 1970-01-01 00:00:00.");
this.updatedMillis = 0L;
}
}
@Override
public String toDocumentString() {
return String.valueOf(this.updatedMillis);
}
}
|