Ada Young avatar Ada Young committed 7b4a3c1

Fixed timestamp handling for received messages to compensate for the lack of year in timestamp

Comments (0)

Files changed (1)

 timestamp = timestamp.split('/')
 year = datetime.now().year
 (month, day, time) = timestamp
-if len(time) < 5:
-    time = "0" + time
-if len(month) < 2:
-    month = "0" + month
-if len(day) < 2:
-    day = "0" + day
-timestamp = "%s-%s-%s %s:00" % (year, month, day, time)
+(hour, minute) = time.split(":")
+
+year = int(year)
+month = int(month)
+day = int(day)
+hour = int(hour)
+minute = int(minute)
+
+timestamp = datetime(year, month, day, hour, minute)
+if timestamp > datetime.now():
+    year -= 1 # subtract one year from timestamp if it seems to be from the future
+
+timestamp = datetime(year, month, day, hour, minute).strftime("%Y-%m-%d %H:%M:%S")
 message_text.append(' '.join(message_chunks[1:]))
 world.EnableTrigger("MessageCaptureFL", False)
 world.EnableTrigger("MessageCapture", True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.