changeset 228:cfdba7ce9a1f

compute offset between LM and crawl timestamp
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 29 Feb 2024 14:59:50 +0000
parents d58bc29a8ec9
children c48f859889da
files lib/python/cc/lmh/compare.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/python/cc/lmh/compare.py	Thu Feb 29 14:59:50 2024 +0000
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+'''Compute difference in seconds between crawl time and Last-Modified time'''
+import sys
+from datetime import datetime, timezone
+
+UTC=timezone.utc
+
+for l in sys.stdin:
+  cctime, lm = l.split()
+  cc = datetime(int(cctime[0:4]),int(cctime[4:6]),int(cctime[6:8]),
+                int(cctime[8:10]),int(cctime[10:12]),int(cctime[12:14]),tzinfo=UTC)
+  print(cctime,lm,float(lm)-cc.timestamp())
+
+