

Her cat had had seven kittens, and she was charmed by the way they would nibble her toes each morning to wake her. The idea for Clocky came to Nanda a of couple years ago. "I can't recall another project that went from zero to infinity, in terms of attention, so quickly," he said. Bove is Nanda's advisor and the director of the CELab, the Media Lab's consumer electronics research program, whose goal is to create "simple, ubiquitous, easy- and delightful-to-use devices."īove has been overwhelmed by the amount of attention bestowed on Clocky so quickly. "Clocky is representing a story people understand," said Principal Research Scientist Michael Bove of the Media Lab. "People from all over the place are offering to beta-test it," said Nanda, who is currently working on patenting Clocky. Clocky is scheduled to make an appearance on "Good Morning America" next week and has been profiled in dozens of newspapers across the country. After a blogger linked to Nanda's site, Clocky-and its creator-suddenly became media darlings. Nanda created Clocky last semester in an industrial design class, but news of her invention started to spread just recently. Its designed to force people up and out of bed, making them less likely to keep snoozing. A few minutes later, when the alarm sounds for a second time, the sleeper must first find the clock before he or she can press snooze again. Working to solve the main cause of oversleeping-the snooze bar-Nanda has designed an early morning hide-and-seek process that could revolutionize the morning for many oversleepers.Ĭlocky-a shag-carpeting-covered digital clock on two wheels-jumps from the bedside table to find a hiding spot each time the snooze bar is pressed.
Clocky code#
Let's say you have code that measures how long a method invocation takes - useful for monitoring purposes.A relatively simple product designed to combat a common problem is turning Media Arts and Science graduate student Gauri Nanda into a celebrity. When it comes to testing, often it doesn't matter what the exact time is during a test.īut there are cases when it matters a lot. This clock returns instants from the specified clock truncated to the nearest occurrence of the specified duration. TickClock, returned by Clock.tick(), Clock.tickMinutes() and Clock.tickSeconds().This clock adds an offset to an underlying clock - which is why you need a second clock to act as the "base" time.

OffsetClock, returned by Clock.offset().This is the type that you would typically use in your application.Īs the name suggests, this clock always returns the same instant.


This clock returns the current instant using best available system clock, usually by calling System.currentTimeInMillis. SystemClock, returned by Clock.system(), Clock.systemDefaultZone() and Clock.systemUTC().The Clock class is an abstract class, and Java ships with a few implementations: Since millis() and instant() are both instance methods of the Clock class, it becomes easier to replace those calls with a test stub. It is equivalent - and in fact delegates to - calling System.currentTimeInMillis.Īpart from millis(), the Clock class provides other valuable methods such as instant() which returns the same value, wrapped in an instance of Instant. The Clock class solves this by providing an instance method, millis. Since that is a static method, it's hard to replace it with a stub for testing purposes. Previously, Java programmers would use System.currentTimeInMillis. This class provides access to the current instant, date and time using a time-zone. Starting with Java 8, Java has a new class:. It lets you control how time flies in your tests. Clocky is a test stub for the class introduced with JSR-310 in Java 8.
