Annotation of researchv10no/cmd/spitbol/getdate.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     getdate.c -- fill a buffer with the date and time
                      3:  */
                      4: 
                      5: #include <time.h>
                      6: 
                      7: getdate (p)
                      8: 
                      9: char *p;
                     10: 
                     11: {
                     12:        long    tod;
                     13:        register struct tm *tm;
                     14:        struct  tm *localtime();
                     15: 
                     16:        time (&tod);
                     17:        tm = localtime (&tod);
                     18: 
                     19:        conv (p, tm->tm_mon+1);
                     20:        p[2] = '/';
                     21:        conv (p+3, tm->tm_mday);
                     22:        p[5] = '/';
                     23:        conv (p+6, tm->tm_year);
                     24:        p[8] = ' ';
                     25:        conv (p+9, tm->tm_hour);
                     26:        p[11] = '.';
                     27:        conv (p+12, tm->tm_min);
                     28:        p[14] = '.';
                     29:        conv (p+15, tm->tm_sec);
                     30: }
                     31: 
                     32: static
                     33: conv (dest, value)
                     34: 
                     35: register char *dest;
                     36: register int value;
                     37: 
                     38: {
                     39:        dest[1] = value % 10 + '0';
                     40:        dest[0] = value / 10 + '0';
                     41: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.