Beispiel #1
0
DDS::ReturnCode_t
DDS::OpenSplice::Utils::copyTimeIn(
    const DDS::Time_t &from,
    os_timeW &to,
    os_int64 maxSupportedSeconds)
{
    DDS::ReturnCode_t result = DDS::RETCODE_OK;
    os_int64 sec = from.sec;

    if ((from.sec == TIMESTAMP_INVALID_SEC) && (from.nanosec == TIMESTAMP_INVALID_NSEC)) {
        to = OS_TIMEW_INVALID;
    } else if (sec > maxSupportedSeconds) {
        result = DDS::RETCODE_BAD_PARAMETER;
        if (sec <= OS_TIME_MAX_VALID_SECONDS) {
            CPP_REPORT(result, "Time value [%" PA_PRId64".%u] is not supported, support for time beyond year 2038 is not enabled",
                      sec, from.nanosec);
        } else {
            CPP_REPORT(result, "Time value [%" PA_PRId64".%u] is not supported the time is too large", sec, from.nanosec);
        }
    } else if ((from.sec >= 0 && from.nanosec < 1000000000)) {
        to = OS_TIMEW_INIT(from.sec, from.nanosec);
    } else {
        result = DDS::RETCODE_BAD_PARAMETER;
    }

    return result;
}
Beispiel #2
0
static os_timeW
os__timeWGet (
    void)
{
    os_time default_time;
    os_timeW current_time;

    default_time = os__timeDefaultTimeGet();
    current_time = OS_TIMEW_INIT(default_time.tv_sec, default_time.tv_nsec);

    return current_time;
}
Beispiel #3
0
static os_timeW
os__timeWGet(
    void)
{
    FILETIME ft;
    ULARGE_INTEGER ns100;
    os_timeW current_time;

    /* GetCurrentFT returns the number of 100-nanosecond
     * intervals since January 1, 1601 (UTC). */
    GetCurrentFT(&ft);
    ns100.LowPart = ft.dwLowDateTime;
    ns100.HighPart = ft.dwHighDateTime;

    current_time = OS_TIMEW_INIT((ns100.QuadPart / 10000000) - OS_TIME_FILETIME_UNIXEPOCH_OFFSET_SECS,
                                 (ns100.QuadPart % 10000000) * 100);

    return current_time;
}