
type SYSTEMTIME
  word wYear,
       wMonth,
       wDayOfWeek,
       wDay,
       wHour,
       wMinute,
       wSecond,
       wMilliseconds
end type

extern lib "kernel32.dll"
!  GetSystemTime (SYSTEMTIME*lpSystemTime)
!  GetLocalTime  (SYSTEMTIME*lpSystemTime)
end extern


function timestr as string (int locl=0) 
=======================================
  '
  function f as string (word v)
  -----------------------------
    return mid( "0"+str(v) , -2)
  end function
  '
  function  m as string (word v)
  ------------------------------
    return mid("00"+str(v), -3)
  end function
  '
  SYSTEMTIME t
  if locl
    GetLocalTime t
  else
    GetSystemTime t
  endif
  return str(t.wYear) "." + f(t.wMonth) "." f(t.wDay) " " +
  f(t.wHour) ":" f(t.wMinute) ":" f(t.wSecond) +
  "." str(t.wMilliseconds)
end function

print "System DateTime: " timestr()
print "Local DateTime: " timestr(1)

