# Clock CHOP

## Summary

The Clock CHOP generates channels that reflect the time of year, month, week, day, hour, minute, second and millisecond. It also has a moon cycle channel. It provides the date as separate channels and in different units. It presents the time in two ways:

• It generates 0-1 ramps that reflect the time of year, month, week, day, hour, minute, second and millisecond.
• It generates integers that reflects the day-of month etc. In this form the year channel is 4 for 2004, etc.

There are sunrise/sunset features, and you can override the day-of-year by inputting 1-6 channels into the CHOP.

## Parameters - Clock Page

Output - Fractions or Units affects the channel data that is output from the Clock CHOP. Fraction gives convenient 0-1 ramps and Units give integers, like 0-23 for the hours of a day. For example, use Fractions and the day, hour and minute channels to drive a wall clock.

Hour Format - 12 hour or 24 hour - Causes the hour channel to cycle through 12 or 24 hours. Also affects the AM/PM channel.

Hour Adjust - After the Clock CHOP reads the current time, it adds Hour Adjust to pretend the current time is different than the actual current time.

Start Reference - The date/time that corresponds to year 0, day 1, hour 0, minute 0. It can be relative to Jan 1, 2000 or to the time that the TouchDesigner process started.

Millisecond - If Output is Units, it is the current millisecond, starting at 0 at the start of a second, going up to 999 at the end of a second. If Output is Fraction, it is the current fraction of a millisecond.

Second - If Output is Units, it is the current second, starting at 0 for on-the-hour, going up to 59. If Output is Fraction, it is the current fraction of a second (45 seconds past the minute gives .75).

Minute - If Output is Units, it is the current minute, starting at 0 for on-the-hour, going up to 59. If Output is Fraction, it is the current fraction of a minute (45 seconds past the minute gives .75).

Hour - If Output is Units, it is the current hour, starting at 0 for midnight and affected by AM/PM. If Output is Fraction, it is the current fraction of an hour (15 minutes past the hour gives .25), taking into account the current minute and second.

AM/PM - 0 if before noon, 1 if after noon.

Day of Week - If Output is Units, it is the actual day of the week, starting with 0 for Monday and 6 for Sunday.

Day of Month - If Output is Units, it is the actual day of the month, so on March 20, it is 20. If Output is Fraction, it is fraction of a day of the current moment, so at 6:30 PM, it is .77, taking into account the hour, minute and second.

Day of Year - If Output is Units, it is the Day of year, starting with 1 for January 1. If it is Fraction, it is the same as Day of Month.

Week - Week of the year, starting with 0 for the first week and 51 for the last week of the year.

Month - Month of the year, starting with 1 for January and 12 for December.

Year - If Output is Units, it is the integer year number relative to the Start Reference, starting at 0, so year 2009 is 9 by default. If Output is Fraction, it is the current fraction of a year, taking into account today's month, day, hour, minute and second.

## Parameters - Solar Page

Latitude - Enter a latitude (hours/min north/south) of your location. (defaults to Toronto, Canada). Fractional hours are permitted. For example: 43.6532 hours and 0 minutes, is identical to 43 hours and 39 minutes. The parameter latitude1 is hours, latitude2 is minutes.

Longitude - Enter a longitude (hours/min east/west) of your location. Fractional hours are permitted. The parameter longitude1 is hours, longitude2 is minutes.

Moon Phase - Outputs the moon phase (0 to 1. .5 is a full moon, 0 and 1 are at the time of the new moon)

Solar Phase - (0 to 1, where sunrise=0, sunset = 1, and it reverses down to 0 in time for the sunrise.

Sunrise - Outputs the sunrise time (0 to 1, midnight=0, twenty-four hours later = 1)

Sunset - Outputs the sunset time (0 to 1, midnight=0, twenty-four hours later = 1)

Declination - (-180 to 180, degrees north/south that the sun is off the equator)

## Inputs

Date/Time Override

To simulate times othen than the present time, you can input another CHOP (like a Constant CHOP) containing exactly 7 channels to the Clock CHOP.

The 7 channels must be named: `year`, `month`, `day`, `hour`, `min`, `sec`, `msec`.

The channels can be fractions and/or outside the regular range, etc. That is, you can set the year, month, day, hour, minute and sweep seconds from 0 to 10,000.

If you send in year = 3, month = 6, day = 5, hour = 9 and minute = 1, then the time is set to June 5, 2003, 9:01 AM. If you increase the hour channel from 9 to 33 over the course of sixty minutes, then you have simulated one full day, ending at June 6, 2003, 9:01 AM

If you send in year and day channels, and you set year to 4 and day to 33.5, then the time is set to Feb 3, 2004 at 12 noon.

If year is 3.0, it is the beginning of 2003, a value of 4.0 is the end of the year (beginning of 2004). Any time in between will be throughout the year.

Or if you just want to test within a specific day, you can offset the hour-adjust parameter value (not the input channel).

## Standard Options and Local Variables

This CHOP is time sliced.