Live data from Hacker News

The Colour Clock

thecolourclock.co.uk

81–90 of 95 posts

Re: The Colour Clock

#81
post #15

Awesome idea. I took some time to rewrite in HTML5: http://brisy.info/colors/ Though the colours I'm getting are different. I wonder why.

Your solution, unlike the Flash one, utterly fails to spike my CPU.

That's a new one on me for things labelled "HTML5". :D

Re: The Colour Clock

#82
post #80

It would be nice if the colour was meaningful, i.e. if one could, at least roughly, guess the time based on the colour. Say, that the brightness would reflect time of day (brightest at noon, darkest at midnight) and the hue the time within the hour.

HSL might work better for that, though I'd cycle it around the spectrum, with the seconds value being the saturation percentage.

Re: The Colour Clock

#84
post #33

Earlier quoted context omitted.

I appreciate the pointlessness of being yet-another recreator, but hey, why not: http://davidlynch.org/toys/colorclock/ :D My quirk is that you can stick a fragment on the end to change the mapping of time to hex. e.g. http://davidlynch.org/toys/colorclock/#smh is seconds=red, minutes=green, hours=blue.

It'd be great if you could add the necessary meta tags to make this fullscreen when saved to home screen on a iOS device. No need for an icon -- iOS already frames the time nicely.

Heh, sure, why not? It now has apple-mobile-web-app-capable=yes.

Re: The Colour Clock

#86
post #22

Earlier quoted context omitted.

Haha, I just did the same thing: http://nerdlife.net/colorclock.html

Guys, get these on github. That way we can fork it & make it awesome as a team faster and better.

Behind the curve here: https://github.com/kemayo/colorclock

Re: The Colour Clock

#87
post #64
post #28

Earlier quoted context omitted.

I can not figure out how such a simple program can manage to take up 100% of my CPU, and despite that not be in sync with my actual clock (it's a random fraction of a second off). Has he not heard of sleep(1) ? Saying "it's flash" is no excuse, flash is perfectly capable of sleeping.

Updating a clock to display the correct time is actually difficult and involved, sleep(1) will not work! The problem reminds me of this Intel article on syncing video output [1] Basically, sleep(1) won't always align with clock updates, so sometimes a given time will display for more or less time than a second. This can be observed by opening the clock widget on Windows XP for example, it's very noticeable. I don't a…

On POSIX systems, clock_nanosleep() can accept an absolute time argument.

  // In a real program one would probably not use time()
  // Also, some older pre-release versions of the realtime
  // kernel patches had the clock_nanosleep() and time() 
  // clocks out of sync by 0.5s (IIRC)
  for(;;) {
    struct timespec after_epoch = { .tv_sec = time(NULL) + 1, .tv_nsec = 0 };
    // Check for EINTR in a real program
    clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &after_epoch, NULL);
    printf("Tick\n");
  }
http://pubs.opengroup.org/onlinepubs/009695399/functions/clo...

Unfortunately, this probably doesn't help with Flash or JavaScript clock demos.

Re: The Colour Clock

#88
post #28
post #25

Earlier quoted context omitted.

I'm on a P4 3Ghz at the moment, whereby I can hear my CPU buzzing away when its under load. On the .co.uk site the buzzing is audible, its taking >70% of the CPU, whereas on your site its nice and quiet taking just 6% of the CPU.

I can not figure out how such a simple program can manage to take up 100% of my CPU, and despite that not be in sync with my actual clock (it's a random fraction of a second off). Has he not heard of sleep(1) ? Saying "it's flash" is no excuse, flash is perfectly capable of sleeping.

Well to get technical there isn't a "sleep" function in flash. The best you can do is use setTimeout, which will call a function back in a specified amount of time. Everything including screen drawing, mouse interaction, effects/animations, code execution, etc all run in a single thread, which means if you could actually sleep(1) it would lock everything up for the full second.
Post reply on HN