time.c 750 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "mph.h"
  13. #include <glib/gtypes.h>
  14. G_BEGIN_DECLS
  15. #ifdef HAVE_STIME
  16. gint32
  17. Mono_Posix_Syscall_stime (mph_time_t *t)
  18. {
  19. time_t _t;
  20. if (t == NULL) {
  21. errno = EFAULT;
  22. return -1;
  23. }
  24. mph_return_if_time_t_overflow (*t);
  25. _t = (time_t) *t;
  26. return stime (&_t);
  27. }
  28. #endif /* ndef HAVE_STIME */
  29. mph_time_t
  30. Mono_Posix_Syscall_time (mph_time_t *t)
  31. {
  32. time_t _t, r;
  33. if (t == NULL) {
  34. errno = EFAULT;
  35. return -1;
  36. }
  37. mph_return_if_time_t_overflow (*t);
  38. _t = (time_t) *t;
  39. r = time (&_t);
  40. *t = _t;
  41. return r;
  42. }
  43. G_END_DECLS
  44. /*
  45. * vim: noexpandtab
  46. */