1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
profanity/util.c

35 lines
489 B
C
Raw Normal View History

2012-02-08 19:48:17 -05:00
#include <time.h>
2012-02-18 17:51:08 -05:00
#include <string.h>
#include <ctype.h>
2012-02-08 19:48:17 -05:00
void get_time(char *thetime)
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(thetime, 80, "%H:%M", timeinfo);
}
2012-02-18 17:51:08 -05:00
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;
}