1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-10-06 20:03:46 -04:00
profanity/util.c
2012-02-18 22:51:08 +00:00

35 lines
489 B
C

#include <time.h>
#include <string.h>
#include <ctype.h>
void get_time(char *thetime)
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(thetime, 80, "%H:%M", timeinfo);
}
char *trim(char *str)
{
char *end;
while (isspace(*str))
str++;
if (*str == 0)
return str;
end = str + strlen(str) - 1;
while (end > str && isspace(*end))
end--;
*(end+1) = 0;
return str;
}