Close

Time for a Long Over Due Update.

A project log for Does Anyone Really Know What Time It is?

If you havent noticed, the clock in the Windows Taskbar has gone missing. Will it ever return?

glgormanglgorman 08/05/2025 at 20:100 Comments

And in other news, I now have the ability to stream GPS data via some of the functions in the Propeller Debug Terminal for that application, which is presently also being repurposed for an eventual "Teapot in the Garden Project".  Calculating the position of the sun in the sky via GPS is also working over there, so maybe I should do yet another major revision of the communications libraries that that project uses, so as to make them callable from any project.  Then I could perhaps start on the otherwise "simple" task of drawing a clock face, all without conditional logic or "need" to make use of trig functions, of course.

Keeping things interesting, of course, I am using some library calls from an otherwise broken version of the chatbot Eliza to parse the GPS data, which is being received via USB, thus providing more than one way to get the time, i.e., so that we can obtain the time from a simple COLEDateTime object or we can get it from GPS, as described in "Teapot in the Garden"

void solar_elements::set_time ()
{
    COleDateTime _dt = COleDateTime::GetCurrentTime();
    m_year = _dt.GetYear ();
    m_month = _dt.GetMonth ();
    m_day = _dt.GetDay ();
    m_hour = _dt.GetHour ();
    m_minute = _dt.GetMinute ();
    m_second = _dt.GetSecond ();
    m_time_zone = -8;
    m_daylight_savings = 0;
}

void solar_elements::set_time (char *str)
{
    COleDateTime _dt = COleDateTime::GetCurrentTime();
    m_year = _dt.GetYear ();
    m_month = _dt.GetMonth ();
    m_day = _dt.GetDay ();

    ASSERT (strlen(str)==6);
    char str_h [4], str_m [4], str_s [4];
    strncpy_s (str_h,4,&str[0],2);
    strncpy_s (str_m,4,&str[2],2);
    strncpy_s (str_s,4,&str[4],2);
    m_hour = atoi(str_h);
    m_minute = atoi(str_m);
    m_second = atoi(str_s);
    m_time_zone = -8;

    if (m_time_zone!=0)
        m_hour = (m_hour+24+m_time_zone)%24;
    m_daylight_savings = 0;
}

Of course, a nice bonus to using GPS is that I now also have the ability to obtain the user's actual longitude and latitude, which can therefore be passed to the solar_elements class for the purpose of finding the current azimuth and elevation of the sun, which can in turn be handed over to OpenGL for such things as determining the lighting model, that is if I ever get around to drawing the actual clock!  At that point, as wonderful as the methods of Euclid are, it is unfortunately necessary to make a few trig calls, not very many, however, from the functions that actually compute the position of the sun.  Since I haven't quite worked out the whole Ptolemy system yet, with corrections as if according to Kepler.  And we all know that infinite series methods did not exist for evaluating trig functions until much later, i.e., until Newton, Taylor, Gauss, Euler, and so on.  Yet not, to worry - just in case on some other hardware platform, if we ever get there - "where we are going - we don't need NO FPU either!"

So maybe, if you can imagine some parallel universe where Microsoft Altair Basic never existed, or any BASIC for that matter, imagine a world where we had no floating point routines, or perhaps no math routines at all, but we could roll our own from day one with C++ operator overloading, then in a C++ "real" class, IEEE-754 (maybe) multiplication might look like this, provide that you have regular 32 bit operations defined somewhere else.

real real::operator * (real arg)
{
    short _sign;
    real result;
    short exp1 = this->exp()+arg.exp()-127;
    unsigned int frac1, frac2, frac3, frac4, fracr;
    unsigned short s1, s2;
    unsigned char c1, c2;
    _sign = this->s^arg.s;
    frac1 = this->f;
    frac2 = arg.f;
    s1 = (frac1>>7);
    s2 = (frac2>>7);
    c1 = (frac1&0x7f);
    c2 = (frac2&0x7f);
    frac3 = (c1*s2+c2*s1)>>16;
    frac4 = (s1*s2)>>9;
    fracr = frac1+frac2+frac3+frac4;
    if (fracr>0x007FFFFF)
    {
        fracr = ((fracr+(1<<23))>>1);
        exp1++;
    }
    result.dw = (fracr&0x007FFFFF)|(exp1<<23)|(_sign<<31);
    return result;
}

 Just in case you have a C++ compiler for your NOR computer, if you have one, but no math routines.  Well, what else is there to say, except that it can all be done in C++, including the 32-bit math, based on NOR instructions.  But that is another rabbit hole to be explored further elsewhere, whether in whole or in part.

Time to return to the project at hand, therefore.  Just as soon as I figure out what it is actually going to do.

A quick screenshot shows where things are right now, graphics-wise.  Eventually, I will post the code for a file named euclid.cpp, which has grown to about 1500 lines, just to get stuff done like finding bisectors, perpendiculars, parallels, points of intersection and so on.

void euclidian::draw_clock ()
{
    fpoint minute_marks [60];
    dodecagon hour_marks;
    pentagon penta;

    hour_marks = construct_dodecagon (true);
    penta = construct_pentagon (true);
    euclidian::bind(*m_host,hour_marks);
    hour_marks.on_draw (false,true);
    fpoint center = hour_marks.m_center;
    fpoint radial = hour_marks.m_points[0];
    m_host->draw_polygon(center,radial);    
}

 An idea comes to mind, therefore, about a possible correlation to Moore's law, and that is the idea, I think, that it sometimes becomes possible to get exponentially more stuff done as more capabilities are added.  Maybe that is a variation of Metcalf's law? We can, of course, now combine the idea of drawing a hexagon with the idea of bisecting the internal angles thereof, in order to be able to compute our hour marks.  Yet at the same time, now we can also consider how to use the fact that 12 and 5 are relatively prime with each other, so as to consider how to draw twelve rotated pentagons, if that is what it takes to generate the minute marks.

dodecagon euclidian::construct_dodecagon (bool draw)
{
    fpoint pt0,pt1,pt2,pt3,pt4;
    dodecagon decca;
    hexagon hex = construct_hexagon (false);
    int i;
    double len1;
//    first copy the even points over
    decca.m_center = hex.m_center;
    for (i=0;i<6;i++)
    decca.m_points [2*i] = hex.m_points [i];
    
    pt0 = decca.m_center;
    for (i=0;i<6;i++)
    {
    pt1 = decca.m_points [2*i];
    pt2 = decca.m_points [(2*(i+1))%12];
    pt3 = bisect (pt0,pt1,pt2);
    len1 = fpoint::length (pt0,pt1);
    pt4 = fpoint::extend0 (segment (pt0,pt3),len1);
    decca.m_points [2*i+1] = pt4;
    }
    return decca;
}

Here, it is easy to see that all we needed to do to get the hour marks is to start with a hexagon, and then bisect the internal angles, and extend the bisector line segments until they are the length of the appropriate radius.  Perhaps the code for drawing a rectangle would have more utility if it were possible to generate, position, and also rotate a collection of small rectangles, so that these can, in turn, be used, perhaps with OpenGL, for example, to obtain a more pleasing 3-dimensional view.  Of course, as much fun as branchless programming is, eventually it does become useful to sneak some loops in.   Maybe someday, I will try to hide some, if not all of the looping code, in some kind of scheduler.   That would generally be very bad for an inner loop, but if enough functions were actually called from some kind of loop manager, then maybe that could be put to use, if I wanted to make videos about Euclid's methods, for example.  That will have to wait for now.  Even though it also would help with the prospect of having a clock that you could give natural language commands to, like "When the sun comes up, dispense cat food."

Eventually.

There are plenty of paths that can be taken right now, that is to say, in the meantime.  Pun intended.  While it would be trivial to come up with a Windows clock application, so why not do that, while at the same time, I know that I should be considering having a dedicated actual replacement for the taskbar clock.  One with GPS synchronization, if available. Or a stopwatch feature, for those times when you want to do something, like take your pulse, the old-fashioned way.  Or add SMPTE time code monitoring, and or other.  And eliminating advertising.  If I want an event list, it should be populated with the events that I want, not an ever-changing sea of "suggested" events that I did not ask for.

Discussions