File: timeaux.c

package info (click to toggle)
bass 1.0.7-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 988 kB
  • ctags: 721
  • sloc: ansic: 2,545; makefile: 133; sh: 111
file content (42 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* boring, obvious, design devision code. */
#include "timeaux.h"

/* return current week day (0..6) */
int time_get_day(void)
{
 struct tm *tms;
 time_t t;

 time(&t);
 tms = gmtime(&t);
 return tms->tm_wday;
}

/* Return current hour (0..23) */
int time_get_hour(void)
{
 struct tm *tms;
 time_t t;

 time(&t);
 tms = gmtime(&t);
 return tms->tm_hour;
}

/* Return current minute (0..59) */
int time_get_minute(void)
{
 struct tm *tms;
 time_t t;

 time(&t);
 tms = gmtime(&t);
 return tms->tm_min;
}

/* Return elapsed seconds since 1970. Current time in seconds. */
time_t time_now(void)
{
 return time(NULL);
}