ser_time.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * $Id$
  3. *
  4. * time related functions
  5. *
  6. * Copyright (C) 2006 iptelorg GmbH
  7. *
  8. * Permission to use, copy, modify, and distribute this software for any
  9. * purpose with or without fee is hereby granted, provided that the above
  10. * copyright notice and this permission notice appear in all copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  13. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  15. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  16. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  17. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  18. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19. */
  20. /* History:
  21. * --------
  22. * 2008-07-16 initial version (andrei)
  23. */
  24. #ifndef _ser_time_h
  25. #define _ser_time_h
  26. #include <sys/time.h>
  27. #include <time.h>
  28. /* time(2) equivalent, using ser internal timers (faster then a syscall) */
  29. time_t ser_time(time_t* t);
  30. /* gettimeofday(2) equivalent, faster but much more imprecise
  31. * (in normal conditions should be within 0.1 s of the real time)
  32. * WARNING: ignores tz (it's obsolete anyway) */
  33. int ser_gettimeofday(struct timeval* tv, const struct timezone *tz);
  34. #endif /* _ser_time_h */