FieldTypes.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (c) 2001-2014
00003 **
00004 ** This file is part of the QuickFIX FIX Engine
00005 **
00006 ** This file may be distributed under the terms of the quickfixengine.org
00007 ** license as defined by quickfixengine.org and appearing in the file
00008 ** LICENSE included in the packaging of this file.
00009 **
00010 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 **
00013 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00014 **
00015 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00016 ** not clear to you.
00017 **
00018 ****************************************************************************/
00019 
00020 #ifdef _MSC_VER
00021 #include "stdafx.h"
00022 #else
00023 #include "config.h"
00024 #endif
00025 
00026 #include "FieldTypes.h"
00027 
00028 #ifdef HAVE_FTIME
00029 # include <sys/timeb.h>
00030 #endif
00031 
00032 namespace FIX {
00033 
00034 DateTime DateTime::nowUtc()
00035 {
00036 #if defined( HAVE_FTIME )
00037     timeb tb;
00038     ftime (&tb);
00039     return fromUtcTimeT (tb.time, tb.millitm);
00040 #elif defined( _POSIX_SOURCE )
00041     struct timeval tv;
00042     gettimeofday (&tv, 0);
00043     return fromUtcTimeT( tv.tv_sec, tv.tv_usec / 1000 );
00044 #else
00045     return fromUtcTimeT( ::time (0), 0 );
00046 #endif
00047 }
00048 
00049 DateTime DateTime::nowLocal()
00050 {
00051 #if defined( HAVE_FTIME )
00052     timeb tb;
00053     ftime (&tb);
00054     return fromLocalTimeT( tb.time, tb.millitm );
00055 #elif defined( _POSIX_SOURCE )
00056     struct timeval tv;
00057     gettimeofday (&tv, 0);
00058     return fromLocalTimeT( tv.tv_sec, tv.tv_usec / 1000 );
00059 #else
00060     return fromLocalTimeT( ::time (0), 0 );
00061 #endif
00062 }
00063 
00064 }

Generated on Mon Sep 15 2014 01:23:54 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001