diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-16 14:45:03 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-16 15:58:16 +0100 |
commit | b55234a74d17503ca2fecb273cfcc44549f9e43e (patch) | |
tree | 321ef06dec317ff0e92011e1d680965e058b10fc /src/systemtime.c | |
parent | Unlist redshift/issues/846: rejected on technical grounds (diff) | |
download | redshift-ng-b55234a74d17503ca2fecb273cfcc44549f9e43e.tar.gz redshift-ng-b55234a74d17503ca2fecb273cfcc44549f9e43e.tar.bz2 redshift-ng-b55234a74d17503ca2fecb273cfcc44549f9e43e.tar.xz |
Major refactoring and some fixes
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'src/systemtime.c')
-rw-r--r-- | src/systemtime.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/systemtime.c b/src/systemtime.c deleted file mode 100644 index 17f516b..0000000 --- a/src/systemtime.c +++ /dev/null @@ -1,61 +0,0 @@ -/* systemtime.c -- Portable system time source - * This file is part of redshift-ng. - * - * redshift-ng is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * redshift-ng is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with redshift-ng. If not, see <http://www.gnu.org/licenses/>. - * - * Copyright (c) 2010-2014 Jon Lund Steffensen <jonlst@gmail.com> - * Copyright (c) 2025 Mattias Andrée <m@maandree.se> - */ -#include "common.h" - - -double -systemtime_get_time(void) -{ -#if defined(WINDOWS) - FILETIME now; - ULARGE_INTEGER i; - GetSystemTimeAsFileTime(&now); - i.LowPart = now.dwLowDateTime; - i.HighPart = now.dwHighDateTime; - /* FILETIME is tenths of microseconds since 1601-01-01 UTC */ - return (i.QuadPart / 10000000.0) - 11644473600.0; - -#elif defined(_POSIX_TIMERS) - struct timespec now; - if (clock_gettime(CLOCK_REALTIME, &now)) - eprintf("clock_gettime CLOCK_REALTIME:"); - return now.tv_sec + (now.tv_nsec / 1000000000.0); - -#else - struct timeval now; - if (gettimeofday(&now, NULL)) - eprintf("gettimeofday:"); - return now.tv_sec + (now.tv_usec / 1000000.0); -#endif -} - - -void -systemtime_msleep(unsigned int msecs) -{ -#ifdef WINDOWS - Sleep(msecs); -#else - struct timespec sleep; - sleep.tv_sec = (time_t)(msecs / 1000U); - sleep.tv_nsec = (long)(msecs % 1000U) * 1000000L; - nanosleep(&sleep, NULL); -#endif -} |