nicetime.c
来自「运行在linux下的聊天软件」· C语言 代码 · 共 44 行
C
44 行
/*
nicetime.c
for Free Chat
by Bill Kendrick
kendrick@zippy.sonoma.edu
http://zippy.sonoma.edu/kendrick/
June 10, 1997
*/
#include <stdio.h>
#include <string.h>
#include "nicetime.h"
char * nicetime(char * time)
{
int hour;
char better[16];
strcpy(better, time);
if (time[0] == '2' || (time[0] == '1' && time[1] >= '2'))
{
strcpy(better, time);
hour = (time[0] - '0') * 10 + (time[1] - '0');
if (hour > 12)
hour = hour - 12;
better[0] = (hour / 10) + '0';
better[1] = hour - (hour / 10) * 10 + '0';
strcat(better, "p");
}
else
strcat(better, "a");
return(strdup(better));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?