News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Time Check

Started by shankle, December 01, 2007, 01:12:51 PM

Previous topic - Next topic

shankle

I'm checking in a program for the month of December.
If I change the date to 11-29-07 the program is
stopped.
If I change the date to 11-30-07 time 1:00 AM to 6:00
PM the program is stopped.
If the time is between 7:00 and 11:59 PM on 11-30-07
the program runs. Completely baffled
Thanks,
JPS
The greatest crime in my country is our Congress

evlncrn8

are you using local time or system time? because there is a difference between the two...

shankle

Thank you for responding Evlncrn8.
I used "GetSystemTime" in the program.
I guess I should have used "GetLocalTime".
Although I really don't understand the difference.
JPS
The greatest crime in my country is our Congress

Tedd

code..? :P


LocalTime is the time your windows clock says (hopefully the correct time for your particular time-zone.)
SystemTime is supposed to be GMT, from where everyone else should co-ordinate their time (zero meridian) -- where your local time will be something like GMT+6, or whatever your offset is (though SystemTime is actually LocalTime-6 instead, but that's just a cheat.)
No snowflake in an avalanche feels responsible.

Tight_Coder_Ex

Quote from: Tedd on December 01, 2007, 03:17:53 PM
SystemTime is supposed to be GMT

Or the new buzzword these days is UCT  Universal Coordinated Time.  Same difference though, but somebody somewhere had their 15 second claim to fame changing it.  Point being all my databases or most I should say have time stamps that are recorded in UCT.  Therefore if you look at a record in the Pacific time Zone that was posted at noon and then view that same record in Eastern time zone it will show 3:00 pm.

That way no matter where you are in the world the stamp will be relative to your time.
As Tedd says though, this is entirely defendant upon you system's regional setting being representative of your timezone.

GregL

I wrote a DateTime library to try and make working with dates and times easier. There is a help file included.


.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE

INCLUDE windows.inc

INCLUDE kernel32.inc
INCLUDE user32.inc
INCLUDE msvcrt.inc
INCLUDE masm32.inc
INCLUDE DateTime.inc

INCLUDE c:\masm32\macros\macros.asm

INCLUDELIB kernel32.lib
INCLUDELIB user32.lib
INCLUDELIB msvcrt.lib
INCLUDELIB masm32.lib
INCLUDELIB DateTime.lib

main PROTO

.DATA

    ALIGN 8
    dtLocal DATETIME 0
 
.CODE

start:

    call main
    inkey chr$(13,10,"Press any key to exit ... ")
    INVOKE ExitProcess, 0

main PROC

    INVOKE GetLocalDateTime, ADDR dtLocal
    INVOKE Month, ADDR dtLocal
    .IF eax == 12
        print chr$("It's December",13,10)
    .ELSE
        print chr$("It's not December",13,10)
    .ENDIF   
   
    ret

main ENDP

END start