File: date.c

package info (click to toggle)
bombardier 0.8.2.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 172 kB
  • ctags: 74
  • sloc: ansic: 796; makefile: 60; sh: 39; perl: 33
file content (17 lines) | stat: -rw-r--r-- 324 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

char * ascdate()
{
    time_t timet;
    struct tm *tm;
    static char *retstr;
    
    retstr=malloc(11);
    timet=time(NULL);
    tm=localtime(&timet);
    sprintf(retstr, "%4d-%.2d-%.2d", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
    
    return retstr;
}