RTTimeNow-posix.cpp revision bc400f01f6db80c47cf6b659a98c19c79a91159f
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync/* $Id$ */
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync/** @file
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * InnoTek Portable Runtime - RTTimeNow, POSIX.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync */
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync/*
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync *
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * available from http://www.virtualbox.org. This file is free software;
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * you can redistribute it and/or modify it under the terms of the GNU
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * General Public License as published by the Free Software Foundation,
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync *
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * If you received this file as part of a commercial VirtualBox
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * distribution, then only the terms of your commercial VirtualBox
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * license agreement apply instead of the previous paragraph.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync */
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync/*******************************************************************************
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync* Header Files *
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync*******************************************************************************/
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync#define LOG_GROUP RTLOGGROUP_TIME
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync#define RTTIME_INCL_TIMEVAL
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync#include <sys/time.h>
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync#include <time.h>
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync#include <iprt/time.h>
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync/**
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * Gets the current system time.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync *
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * @returns pTime.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync * @param pTime Where to store the time.
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync */
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsyncRTR3DECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync{
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync struct timeval tv;
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync gettimeofday(&tv, NULL);
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync return RTTimeSpecSetTimeval(pTime, &tv);
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync}
bc400f01f6db80c47cf6b659a98c19c79a91159fvboxsync