home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyth_os2.zip / python-1.0.2 / Modules / timingmodule.c < prev    next >
C/C++ Source or Header  |  1994-01-14  |  2KB  |  115 lines

  1. /*
  2.  *
  3.  * File: $Id: timingmodule.c,v 2.2 1994/01/14 16:55:50 guido Exp $
  4.  *
  5.  * Author: George V. Neville-Neil
  6.  *
  7.  * Update History: $Log: timingmodule.c,v $
  8.  * Revision 2.2  1994/01/14  16:55:50  guido
  9.  * Make more robust against Minix and Mac
  10.  *
  11.  * Revision 2.1  1994/01/02  23:22:21  guido
  12.  * Added George Neville-Neil's timing module
  13.  *
  14.  * Revision 1.1  93/12/28  13:14:39  gnn
  15.  * Initial revision
  16.  * 
  17.  * 
  18.  *
  19.  *
  20.  */
  21.  
  22. #ifndef lint
  23. #ifndef THINK_C
  24. static char rcsid [] = "$Header: /hosts/voorn/ufs/guido/python-RCS/new/Modules/RCS/timingmodule.c,v 2.2 1994/01/14 16:55:50 guido Exp $" ;
  25. #endif /* THINK_C */
  26. #endif /* lint */
  27.  
  28. #include "allobjects.h"
  29. #include "import.h"
  30. #include "modsupport.h"
  31. #include "ceval.h"
  32.  
  33. /* Our stuff... */
  34. #include "timing.h"
  35.  
  36. static object *
  37. start_timing(self, args)
  38.     object *self;
  39.     object *args;
  40. {
  41.     if (!getargs(args, ""))
  42.     return NULL;
  43.  
  44.     INCREF(None);
  45.     BEGINTIMING;
  46.     return None;
  47. }
  48.  
  49. static object *
  50. finish_timing(self, args)
  51.     object *self;
  52.     object *args;
  53. {
  54.     if (!getargs(args, ""))
  55.     return NULL;
  56.  
  57.     ENDTIMING    
  58.     INCREF(None);
  59.     return None;
  60. }
  61.  
  62. static object *
  63. seconds(self, args)
  64.     object *self;
  65.     object *args;
  66. {
  67.     if (!getargs(args, ""))
  68.     return NULL;
  69.  
  70.     return newintobject(TIMINGS);
  71.  
  72. }
  73.  
  74. static object *
  75. milli(self, args)
  76.     object *self;
  77.     object *args;
  78. {
  79.     if (!getargs(args, ""))
  80.     return NULL;
  81.  
  82.     return newintobject(TIMINGMS);
  83.  
  84. }
  85. static object *
  86. micro(self, args)
  87.     object *self;
  88.     object *args;
  89. {
  90.     if (!getargs(args, ""))
  91.     return NULL;
  92.  
  93.     return newintobject(TIMINGUS);
  94.  
  95. }
  96.  
  97.  
  98. static struct methodlist timing_methods[] = {
  99.    {"start", start_timing},
  100.    {"finish", finish_timing},
  101.    {"seconds", seconds},
  102.    {"milli", milli},
  103.    {"micro", micro},
  104.    {NULL, NULL}
  105. };
  106.  
  107.  
  108. void inittiming()
  109. {
  110.     object *m;
  111.  
  112.     m = initmodule("timing", timing_methods);
  113.    
  114. }
  115.