Detect Time Travel

Python 2, 210 bytes

from datetime import*
o=0
while 1:n=datetime.now();o=o or n;print"%s;%s: %s? You mean we're in the future?"%(o,n,n.year)if(n-o).days>=1else"%s;%s: Back in good old %s."%(n,o,n.year)if(n<o)else"Great Scott!";o=n

Timestamps are printed in in YYYY-MM-DD HH:MM:SS format, separated with semicolons. Switched to Python 2 from 3 since it's 2 chars shorter to print. Spams stdout with Great Scott! for normies non-time-travellers, since it's easier and cheaper to do that than set up a conditional print.


JavaScript (ES6), 263 bytes

n=Date;o=n.now();(function g(){k=new n;j=new n(o);s=`${k} ${o} `;if(n.now()-o>86400)console.log(`${s}${k.getFullYear()}? You mean we're in the future?`);if(o-n.now()>84600){console.log(`${s}Back in good old ${k.getFullYear()}.`);}o=n.now();setTimeout(g,100);}());

This could probably do with some rewriting to make it more efficient/small.

Source:

n=Date;
o=n.now();

(function go() {
   k=new n;
   j=new n(o);
   s=`${k} ${o} `;
   if (n.now() - o > 86400) {
      console.log(`${s}${k.getFullYear()}? You mean we're in the future?`);
   }
   if (o - n.now() > 84600) {
      console.log(`${s}Back in good old ${k.getFullYear()}.`);
   }
   o=n.now()
   setTimeout(go,100);
}());

Python 3, 195

from datetime import*
n=datetime.now
p=n()
while 1:
 c=n();f=(p,c,p.year);s=(0,("%s %s: %s? You mean we're in the future?"%f,"%s %s: Back in good old %s."%f)[p.day>c.day])[p>c];p=c
 if s:print(s)

Currently doesn't print Great Scott because I can't find a good way of only making it occasional.

Tags:

Date

Code Golf