Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mxcpcTime_win.cpp

Go to the documentation of this file.
00001 //           ///          //                                        Mx clientSDK
00002 //          /////        ////                    Mx Crossplatform Client Library
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcTime_win.cpp,v $
00005 //       ///       XXX       ///     $Revision: 1.1 $
00006 //      ///      XXX XXX      ///     $Date: 2006/01/16 15:37:00 $
00007 //     ////    XXX     XXX    ////     $Author: cvs-kai $
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems //////////////////////////////////////////////
00011 //                                                                          //
00012 //  Copyright (C) 2005 - 2006, MOBOTIX AG, Germany                         //
00013 //  This software is made available under the BSD licence. Please refer   //
00014 //  to the file LICENCE.TXT contained in this distribution for details.  //
00015 //                                                                      //
00016 //  /////////////////////////////////////////////////////////////////////
00017 
00018 
00019 
00020 /*! 
00021  *  \file mxcpcTime_win.cpp
00022  *
00023  *  \brief Alternate implementation for the <tt>WINDOWS</tt> platform
00024  * 
00025  *  Differs from the original UNIX implementation in that we have to use another
00026  *  method for accessing the system time.
00027  */
00028 
00029 
00030 
00031 #include <mxcpcTime.h>
00032 #include <mxcpc_namespace.h>
00033 
00034 #include <windows.h>
00035 
00036 
00037 
00038 mxcpcTime::mxcpcTime() {
00039 
00040   setBaseTime();
00041 }
00042 
00043 
00044 
00045 void mxcpcTime::setBaseTime(void) {
00046 
00047   BaseTicks = GetTickCount();
00048 }
00049 
00050 
00051 int mxcpcTime::elapsed(void) {
00052 
00053   unsigned long current_ticks;
00054   int delta_msecs;
00055   
00056   current_ticks = GetTickCount();
00057   
00058   if(current_ticks > BaseTicks) {
00059     delta_msecs = (int)(current_ticks - BaseTicks);
00060   }
00061   else {
00062     mxcpc::sendStatusMsg("Time_win : *** tick counter overflow detected!");
00063     delta_msecs = 0;
00064   }
00065   if(delta_msecs < 0) {
00066     mxcpc::sendStatusMsg("Time_win : *** time difference too high!");
00067     delta_msecs = 0;
00068   }
00069     
00070   BaseTicks = current_ticks;
00071   
00072   return(delta_msecs);
00073 }
00074 

Generated on Mon Jan 30 15:13:08 2006 for mxcpc by  doxygen 1.4.4