diff options
| author | Patrick Williams <iawillia@us.ibm.com> | 2012-05-11 13:53:11 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-05-21 09:44:55 -0500 |
| commit | f4161d714e3e9de684610e35f6dd42c3a2cabc94 (patch) | |
| tree | 1a3b0fc6e9a11520e302d29558a63cf97cb41c51 /src/lib/syscall_time.C | |
| parent | 70961ee3265e37813c4fb89dfd7a5660ae4b189a (diff) | |
| download | blackbird-hostboot-f4161d714e3e9de684610e35f6dd42c3a2cabc94.tar.gz blackbird-hostboot-f4161d714e3e9de684610e35f6dd42c3a2cabc94.zip | |
Support for POSIX clock_gettime function.
Change-Id: I004772e9005ce08d72d666a9b4073afd7b74e582
RTC: 41635
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1053
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/lib/syscall_time.C')
| -rw-r--r-- | src/lib/syscall_time.C | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/syscall_time.C b/src/lib/syscall_time.C index d4ea6d0a7..819b605b0 100644 --- a/src/lib/syscall_time.C +++ b/src/lib/syscall_time.C @@ -20,8 +20,11 @@ // Origin: 30 // // IBM_PROLOG_END +#include <time.h> #include <sys/time.h> #include <sys/syscall.h> +#include <errno.h> +#include <kernel/timemgr.H> using namespace Systemcalls; @@ -29,3 +32,28 @@ void nanosleep(uint64_t sec, uint64_t nsec) { _syscall2(TIME_NANOSLEEP, (void*)sec, (void*)nsec); } + +int clock_gettime(clockid_t clk_id, timespec_t* tp) +{ + if (unlikely(NULL == tp)) { return -EFAULT; } + + int rc = 0; + + switch(clk_id) + { + case CLOCK_REALTIME: // TODO: Need a message to the FSP to get the + // real-time. + rc = -EINVAL; + break; + + case CLOCK_MONOTONIC: + TimeManager::convertTicksToSec(getTB(), tp->tv_sec, tp->tv_nsec); + break; + + default: + rc = -EINVAL; + break; + } + + return rc; +} |

