///////////////////////////////////////////////////////////////////////////////////////////////////////
//     SunClock (download software processing.org + paste code)
//     A yellow field moving at a computer screen. It reflects the suns movements 
//     in the sky and the movement can hardly be seen, but it s moving all the time. 
//    When the sun rises a yellow field starts to move, first the field can hardly 
//     be seen but the more the sun moves the more you can see of the yellow field. 
//     At the middle of the day the whole field can be seen and the whole screen are 
//     yellow. It could be seen as a slowly moving painting. When the sun goes down 
//     the yellow field disappear. You can follow the sun live, a digital Sun.
///////////////////////////////////////////////////////////////////////////////////////////////////////

import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
    GregorianCalendar gcdown, gcup, gcNow, gcdate;
    long  elapsedTime;
    long elapsedTime_Now;
    float sun_now;
    float sun =300;  
    float sun_min;
    float sun_pos;
    int d = day();          // Values from 1 - 31
    int m = month();  // Values from 1 - 12 
    int y = year();       // Values 2003

      public void setup() {
      background(0);
      size(300, 300);
      gcup = new GregorianCalendar  (y, m-1, d, 06, 36, 00);     // Sunrise  Crete
      gcdown = new GregorianCalendar(y, m-1, d, 19, 59, 00);     // Sunset   Crete
      
  }
     void draw() {
       gcNow = new GregorianCalendar();
       elapsedTime = gcdown.getTimeInMillis()-gcup.getTimeInMillis()  ;
       elapsedTime_Now = gcdown.getTimeInMillis() -gcNow.getTimeInMillis();
       sun_min = elapsedTime/1000;
       sun_now =elapsedTime_Now/1000;
       sun =300/sun_min;       
       sun_pos = sun * sun_now;
       float soll =300-sun_pos;
       fill(255, 204, 0);
       rect(0,sun_pos-soll, 300, 310);
        }