3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync/* $Id$ */
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync/** @file
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * IPRT - RTTimeSet, POSIX.
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync */
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2010 Oracle Corporation
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync *
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * available from http://www.virtualbox.org. This file is free software;
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * you can redistribute it and/or modify it under the terms of the GNU
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * General Public License (GPL) as published by the Free Software
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync *
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * The contents of this file may alternatively be used under the terms
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * of the Common Development and Distribution License Version 1.0
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * VirtualBox OSE distribution, in which case the provisions of the
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * CDDL are applicable instead of those of the GPL.
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync *
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * You may elect to license modified versions of this file under the
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync * terms and conditions of either the GPL or the CDDL or both.
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync */
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync/*******************************************************************************
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync* Header Files *
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync*******************************************************************************/
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#define LOG_GROUP RTLOGGROUP_TIME
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#define RTTIME_INCL_TIMEVAL
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include <sys/time.h>
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include <time.h>
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include <errno.h>
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include <iprt/time.h>
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include "internal/iprt.h"
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync#include <iprt/err.h>
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsyncRTDECL(int) RTTimeSet(PCRTTIMESPEC pTime)
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync{
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync struct timeval tv;
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync if (settimeofday(RTTimeSpecGetTimeval(pTime, &tv), NULL) == 0)
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync return VINF_SUCCESS;
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync return RTErrConvertFromErrno(errno);
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync}
3f27cda426516776130110dc28f2bedfdfb3d2b5vboxsync