source: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_time.cpp

Last change on this file was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1#include "../include/Sim2OS.h"
2
3namespace environment {
4namespace sim2os {
5
6  void * Sim2OS::service_time (void)
7  {
8    if (have_all_arguments(1) == false)
9      {
10        std::cerr << "<" << name << "> Usage : time_t time(time_t * t);" << std::endl;
11        return NULL;
12      }
13   
14    time_t *t      = (time_t *)     convert_address(arguments[1]);
15    void *  result = (void *)       time(t);
16    error          = errno;
17   
18    std::cout << "\n\t***** service : time          *****" << std::endl;
19    std::cout << "\tt         : " << std::hex << static_cast<int32_t>(reinterpret_cast<int64_t>(t))                                      << std::endl;
20    std::cout << "\tresult    : " << std::dec << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << " - " << ctime((time_t *) t) << std::endl;
21    std::cout << "\terrno     : " <<             (unsigned int) error                                  << std::endl;
22   
23    // Must swap, because it's a pointer
24    t = (time_t *)endianness::swapBytes((char *)t,sizeof(time_t),sizeof(time_t));
25   
26    return result;
27  }
28
29};
30};
Note: See TracBrowser for help on using the repository browser.