time_stamp.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Mach Operating System
  3. * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  4. * All Rights Reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software and its
  7. * documentation is hereby granted, provided that both the copyright
  8. * notice and this permission notice appear in all copies of the
  9. * software, derivative works or modified versions, and any portions
  10. * thereof, and that both notices appear in supporting documentation.
  11. *
  12. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15. *
  16. * Carnegie Mellon requests users of this software to return to
  17. *
  18. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  19. * School of Computer Science
  20. * Carnegie Mellon University
  21. * Pittsburgh PA 15213-3890
  22. *
  23. * any improvements or extensions that they make and grant Carnegie Mellon
  24. * the rights to redistribute these changes.
  25. */
  26. #include <mach/std_types.h>
  27. #include <machine/locore.h>
  28. #include <sys/time.h>
  29. #include <kern/time_stamp.h>
  30. /*
  31. * ts.c - kern_timestamp system call.
  32. */
  33. kern_return_t
  34. kern_timestamp(struct tsval *tsp)
  35. {
  36. /*
  37. temp.low_val = 0;
  38. temp.high_val = ts_tick_count;
  39. */
  40. time_value_t temp;
  41. temp = time;
  42. if (copyout(&temp,
  43. tsp,
  44. sizeof(struct tsval)) != KERN_SUCCESS)
  45. return(KERN_INVALID_ADDRESS);
  46. return(KERN_SUCCESS);
  47. }
  48. /*
  49. * Initialization procedure.
  50. */
  51. void timestamp_init(void)
  52. {
  53. ts_tick_count = 0;
  54. }