📄 whattime.c
字号:
/*
whattime.c
for Free Chat
by Bill Kendrick, ported to NT by Patrick Stepp
kendrick@zippy.sonoma.edu, stepp@adelphia.net
http://zippy.sonoma.edu/kendrick/
October 10, 1997
Note when compiled, two warnings will occur in this file , however this is normal and doesn't affect the program.
*/
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include "whattime.h"
#include "defines.h"
long getthetime()
{
long thetime;
time_t tp;
thetime = (long) time(&tp);
return thetime;
}
void whattime(char * buf)
{
char newshortdate[25];
long date, nowtime, starttime;
static struct tm *cur_time;
static struct tm *ptm;
int x;
for (x=0; x<25; x++)
newshortdate[x] = '\0';
nowtime = starttime = getthetime();
cur_time = localtime((time_t *) &nowtime);
/* Get the time, then create the struct with time values. */
time(&cur_time);
ptm = localtime(&cur_time);
/* Display the time. */
sprintf(newshortdate, "%02d:%02d:%02d", ptm->tm_hour+1, ptm->tm_min, ptm->tm_sec);
strcpy(buf,newshortdate);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -