Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# FieldTypes.cpp

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 ** Copyright (c) quickfixengine.org  All rights reserved.
    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 #include "CallStack.h"
    00026
    00027 #include "FieldTypes.h"
    00028
    00029 #ifdef HAVE_FTIME
    00030 # include <sys/timeb.h>
    00031 #endif
    00032
    00033 namespace FIX {
    00034
    00035 DateTime DateTime::nowUtc()
    00036 {
    00037 #if defined( HAVE_FTIME )
    00038     timeb tb;
    00039     ftime (&tb);
    00040     return fromUtcTimeT (tb.time, tb.millitm);
    00041 #elif defined( _POSIX_SOURCE )
    00042     struct timeval tv;
    00043     gettimeofday (&tv, 0);
    00044     return fromUtcTimeT( tv.tv_sec, tv.tv_usec / 1000 );
    00045 #else
    00046     return fromUtcTimeT( ::time (0), 0 );
    00047 #endif
    00048 }
    00049
    00050 DateTime DateTime::nowLocal()
    00051 {
    00052 #if defined( HAVE_FTIME )
    00053     timeb tb;
    00054     ftime (&tb);
    00055     return fromLocalTimeT( tb.time, tb.millitm );
    00056 #elif defined( _POSIX_SOURCE )
    00057     struct timeval tv;
    00058     gettimeofday (&tv, 0);
    00059     return fromLocalTimeT( tv.tv_sec, tv.tv_usec / 1000 );
    00060 #else
    00061     return fromLocalTimeT( ::time (0), 0 );
    00062 #endif
    00063 }
    00064
    00065 }