src/date.c
/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following functions.
- CMDdate
/* $Id: date.c,v 1.2 1999/09/16 22:17:44 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 %4.4d%2.2d%2.2d%2.2d%2.2d%2.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;
}