Multi-Edit's Top Bar Image - Click here to Return to the Home Page spacer image for website layout News regarding our IDE -click this image- Products of MESI Page -click this image- Support Avenues, Forums, Emails etc. -click this image- Purchase Online -click this image- Resources, Downloads, Zips for Mult-Edit -click this image- Company NFO -click this image- Website Sitemap -click this image-

- Written and documented by David Deley



Introduction to CMac Chapter 8: GetSystemTime

Multi-Edit CMAC has the ability to call external routines provided by the Windows operating system. Here is an example of calling the GetSystemTime routine.

NOTE: GetSystemTime returns Coordinated Universal Time (UTC). It does not take into account what time zone you are in. (i.e. UTC time is 5 hours ahead of Eastern Time; 8 hours ahead of Pacific Time.)

The GetSystemTime function is documented at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemtime.asp

Code:
#include Win32.sh   //Must come before #include MsgLog.sh
                    //(defines struct Tmsg used by MsgLog.sh)
#include MsgLog.sh  //DebugLog is defined here.

/* NOTE: Win32.sh already contains the following,
   so we don't have to include this ourselves:
#define PSystemTime Pointer
struct TSystemTime {
  Word  wYear;
  Word  wMonth;
  Word  wDayOfWeek;
  Word  wDay;
  Word  wHour;
  Word  wMinute;
  Word  wSecond;
  Word  wMilliseconds;
}

import void GetSystemTime( PSystemTime St )
    kernel32 'GetSystemTime';
*/

void testtime()
{
   struct TSystemTime St;
   GetSystemTime( &St );
   DebugLog(2, "testtime",
  "wYear=" + str(St.wYear) +
  " wMonth=" + str(St.wMonth) +
  " wDayOfWeek=" + str(St.wDayOfWeek) +
  " wDay=" + str(St.wDay) +
  " wHour=" + str(St.wHour) +
  " wMinute=" + str(St.wMinute) +
  " wSecond=" + str(St.wSecond) +
  " wMilliseconds=" + str(St.wMilliseconds) );
}