/* -*- Mode: C ; c-basic-offset: 2 -*- */ /* * LADI Session Handler (ladish) * * Copyright (C) 2010 Nedko Arnaudov * ************************************************************************** * This file contains implementations of functions related to time ************************************************************************** * * LADI Session Handler 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 2 of the License, or * (at your option) any later version. * * LADI Session Handler 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 LADI Session Handler. If not, see * or write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include "time.h" /* TODO: implement this with uptime or find some other way to handle time shifts */ uint64_t ladish_get_current_microseconds(void) { struct timeval time; if (gettimeofday(&time, NULL) != 0) return 0; return (uint64_t)time.tv_sec * 1000000 + (uint64_t)time.tv_usec; }