Today the Unix time stamp hits 1234567890. Today, all Unix/Linux geeks around the world are writing scripts like this one:
import time
while time.time() < 1234567890.0:
time.sleep(0.25)
print "The time is",time.time(),"!"
Seriously. Gotta do it.
8 thoughts on “The time is now…”
Comments are closed.
In hex, 1234567890 is 0x499602d2. Not very interesting I’m afraid. I think the correct script is
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct timeval tv;
main() {
do {
(void)usleep(250);
(void)gettimeofday(&tv, NULL);
} until (tv.tv_sec >= 0x49999999);
printf("The time is 0x%x", tv.tv_sec);
}
And yes, in addition to being a geek, I’m old. 3000 years old, in fact. But my hair is still fabulous.
But in hex, 0×49999999 doesn’t roll over to 0×50000000, it rolls over to 0×4999999A…
Anyway, that script was old, old, old. I’ve moved way beyond that now. I laugh at the person I was back then — HAH! Here’s the current script:
import time, os
curtime = 0
partytime = 1234567890.0
while time.time() < partytime: if time.time() - curtime > 1000.0:
curtime = time.time()
delta = partytime-curtime
if delta < 60.0: s = '%d seconds' % (round(delta)) elif delta < 3600.0: s = '%d minutes' % (round(delta/60)) else: h = int(delta/3600.0) m = round((delta-h*3600.0)/60.0) s = '%d hours and %d minutes' % (h,m) print "The current time is %d. %s until The Time." % (round(curtime),s) time.sleep(0.25)
print "The Special Time has arrived! The time is %f!" % time.time()
os.system('curl -u TipaDaKnife:xxxxx -d status="Rejoice, the Unix system time is now: %f." http://twitter.com/statuses/update.json' % time.time())
Ruby!
ruby -e ‘while Time.now.to_i < 1234567890; sleep(0.25); end; p “The time is #{Time.now.to_i}!”
Woot! LOVE RUBY! I learned it around the same time as Python, but Python won my heart first.
I really think python is much more minimalist / clearn then ruby, but at the time I was forced by the gods to choose between it and ruby, I wasn’t able to resist to the awesome japanese gem. And ruby have chunky bacon! (http://poignantguide.net/ruby/)
I’m a day late but….
NNNEEEEEEERRRRRRDDDDDD!
Happy Singles Awareness Day! 🙂
Hey Tipa,
I just wanted to let you know that I’ve linked to you from Bio Break, my general MMO blog. If you’d like to reciprocate linkage, I’d be grateful! (Just trying to get some readership going there.)
Rock on,
Syp
biobreak.wordpress.com
Done!