Add Java Date for timestamps

This commit is contained in:
Jeremy Lakeman 2017-03-29 12:46:10 +10:30
parent f060e4dc59
commit fb2322d45f
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,7 @@
package org.servalproject.servaldna.meshmb;
import java.util.Date;
/**
* Created by jeremy on 10/10/16.
*/
@ -9,6 +11,7 @@ public class PlyMessage implements Comparable<PlyMessage>{
public final long offset;
public final String token;
public final long timestamp;
public final Date date;
public final String text;
public PlyMessage(long _row, long offset, String token, long timestamp, String text){
@ -16,6 +19,7 @@ public class PlyMessage implements Comparable<PlyMessage>{
this.offset = offset;
this.token = token;
this.timestamp = timestamp;
this.date = new Date(timestamp * 1000);
this.text = text;
}

View File

@ -24,6 +24,8 @@ import org.servalproject.servaldna.Subscriber;
import org.servalproject.servaldna.SubscriberId;
import org.servalproject.servaldna.ServalDInterfaceException;
import java.util.Date;
public class MeshMSMessage implements Comparable<MeshMSMessage>{
public enum Type {
@ -47,6 +49,7 @@ public class MeshMSMessage implements Comparable<MeshMSMessage>{
public final boolean isDelivered;
public final boolean isRead;
public final Long timestamp;
public final Date date;
public final Long ackOffset;
protected MeshMSMessage(int rowNumber,
@ -87,6 +90,7 @@ public class MeshMSMessage implements Comparable<MeshMSMessage>{
this.isDelivered = delivered;
this.isRead = read;
this.timestamp = timestamp;
this.date = new Date((timestamp ==null?0:timestamp * 1000));
this.ackOffset = ack_offset;
}