#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <inttypes.h>
#include <poll.h>
#include <getopt.h>
-#include <sys/time.h>
#include <xosd.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#undef DEBUG
-#include "util.h"
+#include "osd.h"
static xosd *osd;
-typedef uint64_t timestamp_t;
static timestamp_t now;
/*** Options ***/
{
pid_t pid = fork();
if (pid < 0)
- {
- fprintf(stderr, "batt: Cannot fork: %m\n");
- return 1;
- }
+ die("Cannot fork: %m");
if (pid > 0)
return 0;
setsid();
for (;;)
{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- now = (timestamp_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ now = get_current_time();
timestamp_t wait_until = now - 1;
if (!current_msg && first_msg)