Oops, another missing forward-struct-declaration.
[sgt/putty] / unix / uxmisc.c
CommitLineData
f7f27309 1/*
2 * PuTTY miscellaneous Unix stuff
3 */
4
5#include <stdio.h>
6#include <sys/time.h>
7
9a30e26b 8#include "putty.h"
9
f7f27309 10unsigned long getticks(void)
11{
12 struct timeval tv;
13 gettimeofday(&tv, NULL);
14 /*
15 * This will wrap around approximately every 4000 seconds, i.e.
16 * just over an hour, which is more than enough.
17 */
18 return tv.tv_sec * 1000000 + tv.tv_usec;
19}
9a30e26b 20
9fab77dc 21Filename filename_from_str(const char *str)
9a30e26b 22{
23 Filename ret;
24 strncpy(ret.path, str, sizeof(ret.path));
25 ret.path[sizeof(ret.path)-1] = '\0';
26 return ret;
27}
28
9fab77dc 29const char *filename_to_str(const Filename *fn)
9a30e26b 30{
9fab77dc 31 return fn->path;
9a30e26b 32}
33
34int filename_equal(Filename f1, Filename f2)
35{
36 return !strcmp(f1.path, f2.path);
37}
38
39int filename_is_null(Filename fn)
40{
41 return !*fn.path;
42}