src/date.c
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- CMDdate
/* $Id: date.c,v 1.2 1998/08/02 20:34:56 proff Exp $
* $Copyright$
*/
#include "nglobal.h"
#include "date.h"
/*
* The "DATE" command. Part of NNTPv2.
*/
EXPORT bool CMDdate ()
/* [<][>][^][v][top][bottom][index][help] */
{
struct tm *gmt;
time_t curtime;
curtime = time ((time_t *) NULL);
if ((gmt = gmtime (&curtime)) == NULL)
{
loge (("gmtime() failed"));
emitf ("%d Can 't get time?!\r\n", NNTP_INTERNAL_VAL);
return FALSE;
}
emitf ("%d %04.4d%02.2d%02.2d%02.2d%02.2d%02.2d\r\n",
NNTP_DATE_FOLLOWS_VAL,
gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
return TRUE;
}