11 Measuring and Simulating Time

Sketch 86: Displaying a Clock

Time in a computer program can mean many things. There is execution time, which is the number of CPU cycles used by a program to a particular point. There is process time, or the amount of time that a program has been active. There is real time, which is the time on your watch. We can also call that clock time. This sketch will acquire the clock time from the computer system and display it as the hands of a traditional clock.

Getting the time of day from Processing is easy. These are the basic functions:

  1. hour(): Returns the current hour in the day using a 24-hour clock.
  2. minute() ...

Get An Artist's Guide to Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.