boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

date-time-stub.after (633B)


      1     } else if (tok == TOK___DATE__ || tok == TOK___TIME__) {
      2 #if BOOTSTRAP
      3         if (tok == TOK___DATE__)
      4             cstrval = "Jan  1 1970";
      5         else
      6             cstrval = "00:00:00";
      7 #else
      8         time_t ti;
      9         struct tm *tm;
     10 
     11         time(&ti);
     12         tm = localtime(&ti);
     13         if (tok == TOK___DATE__) {
     14             snprintf(buf, sizeof(buf), "%s %2d %d", 
     15                      ab_month_name[tm->tm_mon], tm->tm_mday, tm->tm_year + 1900);
     16         } else {
     17             snprintf(buf, sizeof(buf), "%02d:%02d:%02d", 
     18                      tm->tm_hour, tm->tm_min, tm->tm_sec);
     19         }
     20         cstrval = buf;
     21 #endif