Close

Time for some coding...

A project log for C10

Clock for the 'proper' decimal time system

knvdKn/vD 04/21/2016 at 19:568 Comments

Time to start putting things together. Counting C10 time is a really simple thing.

Here is the code that does the whole job of counting time and date:

// C10 date/time structure
struct {
  unsigned char  tick;     // 0..99
  unsigned char centival;  // 0..99
  unsigned char interval;  // 0..99
  unsigned char day;       // 0..9
  unsigned char decade;    // 0..36
  unsigned int year;
} dt;


// must be executed at every exact 0.0864s (one tick)
void clockC10(void) {
  if (++dt.tick>99) {
    dt.tick=0;
    if (++dt.centival>99) {
      dt.centival=0;
      if (++dt.interval>99) {
        dt.interval=0;
        if (++dt.day>9) {
          unsigned char yl=36;    // year length
          // the year will have 37 decades if odd
          // number or multiple by 40
          if ((dt.year&1) || (dt.year%40)==0) yl++;
          dt.day=0;                   
          if (++dt.decade>=yl) {
            dt.decade=0;
            dt.year++;
          }
        }
      }
    }
  }
}

Discussions

Kn/vD wrote 04/22/2016 at 19:20 point

'tenary' is an interesting suggestion. Trying in on my tongue now and it sounds fine. A possible candidate. I will update the project description to include it in the list of suggestions

  Are you sure? yes | no

K.C. Lee wrote 04/22/2016 at 15:45 point

Just use the proper prefix from metric system as your are doing metric time.

https://en.wikipedia.org/wiki/Deca-

e.g. Deci_Year for 1/10 of a year, Deca_Day for 10 days etc.

  Are you sure? yes | no

Kn/vD wrote 04/22/2016 at 19:18 point

'decaday' is a bit tricky for pronunciation, I think...

  Are you sure? yes | no

K.C. Lee wrote 04/22/2016 at 20:17 point

So are the IUPAC organic compounds naming. If you want a non-arbitrary and accurate description of it, following the standard is the way to go.  Everyone else could call it metric week or whatever.

  Are you sure? yes | no

Kn/vD wrote 04/23/2016 at 07:05 point

That is undeniably correct. I will add this suggestion to the project description.

  Are you sure? yes | no

danjovic wrote 04/21/2016 at 23:26 point

Neat! Isn't there another term for 'decade', as it suggests 10 years instead 1/10th of an year? 

  Are you sure? yes | no

Kn/vD wrote 04/22/2016 at 06:11 point

'decade' is actually 10 days in C10. I simply wasn't able to come up with another word for it. It is not unambiguous as the others as it might also refer to (as you already said) 10 years, but what else could be called a period of 10 days?

  Are you sure? yes | no

danjovic wrote 04/22/2016 at 14:01 point

I've been thiking about a good word for that. What do you think of 'tenary'?.

  Are you sure? yes | no