source: trunk/IPs/systemC/hierarchy_memory/sim2os/service/service_time.h @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 1.1 KB
Line 
1#ifndef SERVICE_TIME_H
2#define SERVICE_TIME_H
3
4#include "../sim2os.h"
5
6namespace hierarchy_memory {
7  namespace sim2os {
8
9    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ service_time ]~~~~~
10    void *
11    Sim2os ::
12    service_time ()
13    {
14      if (have_all_arguments(1) == false)
15        {
16          cerr << "<" << NAME << "> Usage : time_t time(time_t * t);" << endl;
17          return NULL;
18        }
19 
20      time_t     *t        = (time_t *)     convert_address(arguments[1]);
21      void *      result   = (void *)       time(t);
22      error                = errno;
23 
24      cout << "\n\t***** service : time          *****" << endl;
25      cout << "\tt         : " << hex << (unsigned int) t                                      << endl;
26      cout << "\tresult    : " << dec << (unsigned int) result << " - " << ctime((time_t *) t) << endl;
27      cout << "\terrno     : " <<        (unsigned int) error                                  << endl;
28
29      // Must swap, because it's a pointer
30      t = (time_t *)swapBytes((char *)t,sizeof(time_t),sizeof(time_t));
31 
32      return      result;
33    }
34
35  };};
36#endif //SERVICE_TIME_H
Note: See TracBrowser for help on using the repository browser.