File: date.c

package info (click to toggle)
bombardier 0.8.5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204 kB
  • sloc: ansic: 829; sh: 50; makefile: 38
file content (22 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Bombardier */
/* The GNU Bombing utility */
/* Copyright (C) 2001, 2009 Gergely Risko */
/* Can be licensed under the terms of GPL v3 or above */

#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;
}