RTTimeLocalNow-generic.cpp revision c695ab003533dff17131a0f1e1f9a85979abf25e
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync/* $Id $ */
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync/** @file
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * InnoTek Portable Runtime - Time, generic RTTimeLocalNow.
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync */
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync/*
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync *
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * available from http://www.virtualbox.org. This file is free software;
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * General Public License as published by the Free Software Foundation,
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync *
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * If you received this file as part of a commercial VirtualBox
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * distribution, then only the terms of your commercial VirtualBox
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * license agreement apply instead of the previous paragraph.
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync */
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync/*******************************************************************************
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync* Header Files *
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync*******************************************************************************/
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync#include <iprt/time.h>
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsyncRTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime)
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync{
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync int64_t i64PreDelta;
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync int64_t i64PostDelta;
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync do
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync {
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync i64PreDelta = RTTimeLocalDeltaNano();
a9f41cb889f53e8407561a6155052c441eb0fc5fvboxsync RTTimeNow(pTime);
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync i64PostDelta = RTTimeLocalDeltaNano();
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync } while (i64PreDelta != i64PostDelta);
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync return RTTimeSpecAddNano(pTime, i64PostDelta);
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync}
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync
a4ba1fc5788b1fb4c078587d5f55936e1b83098dvboxsync