Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Got timestamp tests working again and this time with android

  • Loading branch information...
commit 05c8d1ff7e412c46bd3b5c8051119b8e73e29fb4 1 parent ea1e13b
@patrickbaumann patrickbaumann authored
View
4 geocamMemo/models.py
@@ -49,7 +49,7 @@ def get_date_string(self):
return self.content_timestamp.strftime("%m/%d/%y %H:%M:%S")
def get_date_timestamp(self):
- return int(time.mktime(self.content_timestamp.timetuple()))
+ return int(time.mktime(self.content_timestamp.timetuple())) * 1000 # * 1000 for java timestamp
def get_author_string(self):
return get_user_string(self.author)
@@ -98,7 +98,7 @@ def fromJson(messageDict):
if "content" in messageDict:
message.content = messageDict["content"]
if "contentTimestamp" in messageDict:
- message.content_timestamp = datetime.datetime.fromtimestamp(float(messageDict["contentTimestamp"]))
+ message.content_timestamp = datetime.datetime.fromtimestamp(float(messageDict["contentTimestamp"]) / 1000)
if "latitude" in messageDict:
message.latitude = messageDict["latitude"]
if "longitude" in messageDict:
View
2  geocamMemo/tests/unit.py
@@ -78,7 +78,7 @@ def testEnsureFromJsonCreatesMessag(self):
message = dict(
userId=User.objects.all()[0].pk,
content="Sting!!!",
- contentTimestamp=time.mktime(timestamp.timetuple()),
+ contentTimestamp=time.mktime(timestamp.timetuple()) * 1000,
latitude=1.1,
longitude=222.2,
accuracy=60 )
View
2  geocamTalk/models.py
@@ -72,7 +72,7 @@ def fromJson(messageDict):
if "content" in messageDict:
message.content = messageDict["content"]
if "contentTimestamp" in messageDict:
- message.content_timestamp = datetime.datetime.fromtimestamp(float(messageDict["contentTimestamp"]))
+ message.content_timestamp = datetime.datetime.fromtimestamp(float(messageDict["contentTimestamp"]) / 1000)
if "latitude" in messageDict:
message.latitude = messageDict["latitude"]
if "longitude" in messageDict:
View
2  geocamTalk/templates/geocamTalk/message_list.html
@@ -85,7 +85,7 @@
var msg = data['ms'][i];
var pk = msg['messageId'];
var content = msg['content'];
- var content_timestamp = msg['contentTimestamp'];
+ var content_timestamp = msg['contentTimestamp']; // TODO: convert this to a string
var has_geolocation = msg['hasGeolocation'];
var authorUsername = msg['authorUsername'];
var authorFullname = msg['authorFullname']
View
2  geocamTalk/tests/unit.py
@@ -108,7 +108,7 @@ def testEnsureFromJsonCreatesMessage(self):
message = dict(
userId=User.objects.all()[0].pk,
content="Sting!!!",
- contentTimestamp=time.mktime(timestamp.timetuple()),
+ contentTimestamp=time.mktime(timestamp.timetuple()) * 1000,
latitude=1.1,
longitude=222.2,
accuracy=60 )
Please sign in to comment.
Something went wrong with that request. Please try again.