time.c 760 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * <time.h> wrapper functions.
  3. *
  4. * Authors:
  5. * Jonathan Pryor ([email protected])
  6. *
  7. * Copyright (C) 2004 Jonathan Pryor
  8. */
  9. #define _SVID_SOURCE
  10. #include <time.h>
  11. #include <errno.h>
  12. #include "map.h"
  13. #include "mph.h"
  14. #include <glib.h>
  15. G_BEGIN_DECLS
  16. #ifdef HAVE_STIME
  17. gint32
  18. Mono_Posix_Syscall_stime (mph_time_t *t)
  19. {
  20. time_t _t;
  21. if (t == NULL) {
  22. errno = EFAULT;
  23. return -1;
  24. }
  25. mph_return_if_time_t_overflow (*t);
  26. _t = (time_t) *t;
  27. return stime (&_t);
  28. }
  29. #endif /* ndef HAVE_STIME */
  30. mph_time_t
  31. Mono_Posix_Syscall_time (mph_time_t *t)
  32. {
  33. time_t _t, r;
  34. if (t == NULL) {
  35. errno = EFAULT;
  36. return -1;
  37. }
  38. mph_return_if_time_t_overflow (*t);
  39. _t = (time_t) *t;
  40. r = time (&_t);
  41. *t = _t;
  42. return r;
  43. }
  44. G_END_DECLS
  45. /*
  46. * vim: noexpandtab
  47. */