/*
 *  tinydate.c
 *
 */

#include <stdio.h>
#include <time.h>
#include <unistd.h>



#define EOS '\0'

#ifndef BUFSIZ
#define BUFSIZ 512
#endif

/* 数値を文字列に変換 */
char *num2str(long long d, char *s)
{
    int p;
    int q;
    int ch;

    p = 0;
    do {
	s[p] = '0' + (d % 10);
	++p;
	d /= 10;
    } while (d > 0);
    s[p] = EOS;
    for (q = 0; q < p / 2; q++) {
	ch = s[q];
	s[q] = s[p - q - 1];
	s[p - q - 1] = ch;
    }
    return(s);
}


/* 一文字出力 */
void putch(int fd, unsigned char ch)
{
    write(fd, &ch, 1);
}


/* 文字列出力 */
void myputs(int fd, char *s)
{
    while (*s) {
	putch(fd, *s);
	++s;
    }
}


int main()
{
    char s[BUFSIZ];

    num2str(time(NULL), s);
    myputs(STDOUT_FILENO, s);
    myputs(STDOUT_FILENO, "\n");
    exit(0);
}

/* Local Variables: */
/* compile-command:"cc -Wall -O -s -static -o tinydate tinydate.c" */
/* End: */
