Hi MASM32 coders:
A small proggie that tells the date and time in Ottawa, London, England,
Switzerland in three out of four official languages. Romanish is DNW i e
Does Not Work!
; SWISS.ASM 11:46 AM 6/23/2008
; Modified Thursday, October 03, 2013 3:33:20 AM
;
; Program displays the Time(s) in Canada,
; England, Switzerland.
;
include \masm32\include\masm32rt.inc
.data
public stm
stm SYSTEMTIME<>
stmC SYSTEMTIME<>; CANADA
lcidCAN dd 4105 ; Canada
lcidPQ dd 3084 ; Canada, Quebec
lcidUK dd 2057 ; United Kingdom i e England, Scotland, Wales, etc.
lcidSF dd 4108 ; Swiss French
lcidSG dd 2055 ; Swiss German
lcidSI dd 2064 ; Swiss Italian
lcidSR dd 2073 ; Swiss Romanish?
dd 0
public dtbufE, dtbufF, dtbufG, dtbufI, dtbufQ, dtbufR
db 0
dtbufCb db " "; Space
dtbufC db 260 dup(0); Canada(4105)
dw 0
db 0
dtbufQb db " "
dtbufQ db 260 dup(0); CANADA (Quebec) 3084
db 0
dtbufEb db " "; Space
dtbufE db 260 dup(0); England UTC(2057)
dw 0
dtbufF db 260 dup(0); Swiss French(4108)
dw 0
db 0
dtbufGb db " "; Space
dtbufG db 260 dup(0); Swiss German(2055)
dw 0
dtbufI db 260 dup(0); Swiss italian(2064)
dw 0
dtbufR db 260 dup(0); Swiss Romanish(2072)
dw 0
AppName db "Date & Time in Zurich, Switzerland ", 0
AppNameC db "Date & Time in Ottawa, Ontario, Canada ", 0
AppNameE db "Date & Time in London, England ", 0
AppNameF db "Date & Time in Switzerland - French ",0
AppNameG db "Date & Time in Switzerland - German ",0
AppNameI db "Date & Time in Switzerland - Italian ", 0
AppNameQ db "Date & Time in Montreal, PQ (Quebec), Canada ", 0
AppNameR db "Date & Time in Switzerland - Romanish ", 0
crlf db 13, 10, 0
tf db "HH':'mm':'ss tt", 0
dtError db " << waitExit >> ", 13, 10, 7, 0
Putc db " UTC ", 13, 10, 0
Pedt db " EDT ", 13, 10, 0
Pcet db " CET ", 13, 10, 0
db 0
align 8
.code
insertTime proc
pushad
mov eax,esp
INVOKE GetTimeFormat, 2057, TIME_FORCE24HOURFORMAT, addr stm, addr tf, esi, 32
; 2057 UK to get AM/PM??
add esp,32
ret
insertTime endp
align 8
insertTimeC proc
pushad
mov eax,esp
INVOKE GetTimeFormat, lcidCAN, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
add esp,32
ret
insertTimeC endp
align 8
insertTimeQ proc
pushad
mov eax,esp
INVOKE GetTimeFormat, lcidUK, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
add esp,32
ret
insertTimeQ endp
align 8
start proc
invoke GetLocalTime, addr stmC
invoke GetDateFormat, lcidCAN, DATE_LONGDATE, addr stmC, 0, addr dtbufC, 260
and eax, eax
jz ErGDFCanada
lea esi, offset dtbufC
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTimeC
invoke GetDateFormat, lcidPQ, DATE_LONGDATE, addr stmC, 0, addr dtbufQ, 260
and eax, eax
jz ErGDFQuebec
lea esi, offset dtbufQ
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTimeQ
mov esi, offset stm
invoke GetSystemTime, esi; Get UTC
invoke GetDateFormat, lcidUK , DATE_LONGDATE, addr stm, 0, addr dtbufE, 260
and eax, eax
jz ErGDFEnglish
;
; Do Before Hour Adjust Up for European Time
;
lea esi, offset dtbufE
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTime
mov ax, stm.wHour; This is a Kludge to get Swiss Time
; or European Time i e France, Germany, Italy
inc ax; GET UTC +1 i e CET
mov stm.wHour, ax
invoke GetDateFormat, lcidSF , DATE_LONGDATE, addr stm, 0, addr dtbufF, 260
and eax, eax
jz ErGDFFrench
lea esi, offset dtbufF
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTime
invoke GetDateFormat, lcidSG , DATE_LONGDATE, addr stm, 0, addr dtbufG, 260
and eax, eax
jz ErGDFGerman
lea esi, offset dtbufG
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTime
invoke StdOut, addr dtbufGb
invoke GetDateFormat, lcidSI , DATE_LONGDATE, addr stm, 0, addr dtbufI, 260
and eax, eax
jz ErGDFItalian
lea esi, offset dtbufI
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTime
invoke GetDateFormat, lcidSR , DATE_LONGDATE, addr stm, 0, addr dtbufR, 260
and eax, eax
jz ErGDFRomanish
lea esi, offset dtbufR
add esi , eax ; eax is len of format
mov byte ptr [ esi - 1 ] , " "
call insertTime
jmp NoError
ErGDFCanada:
invoke StdOut, addr crlf
print " << GetDateFormat Canada >> ", 13, 10, 7
jmp waitExit
ErGDFQuebec:
invoke StdOut, addr crlf
print " << GetDateFormat Quebec >> ", 13, 10, 7
jmp waitExit
ErGDFEnglish:
invoke StdOut, addr crlf
print " << GetDateFormat English >> ", 13, 10, 7
jmp waitExit
ErGDFFrench:
invoke StdOut, addr crlf
print " << GetDateFormat French >> ", 13, 10, 7
jmp waitExit
ErGDFGerman:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat German >> ", 13, 10, 7
jmp waitExit
ErGDFItalian:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat Italian >> ", 13, 10, 7
jmp waitExit
ErGDFRomanish:
invoke StdOut, addr crlf
print " << GetDateFormat Romanish >> ", 13, 10, 7
waitExit:
INVOKE MessageBox, 0, addr dtError, addr AppName, MB_OK
NoError:
invoke MessageBox, 0, addr dtbufC, addr AppNameC, MB_OK; CANADA Time GMT-4
invoke MessageBox, 0, addr dtbufQ, addr AppNameQ, MB_OK; Quebec Time GMT-4
invoke MessageBox, 0, addr dtbufE, addr AppNameE, MB_OK; England Time GMT+0
invoke MessageBox, 0, addr dtbufF, addr AppNameG, MB_OK; Swiss Time - French GMT+1
invoke MessageBox, 0, addr dtbufG, addr AppNameF, MB_OK; Swiss Time - German GMT+1
invoke MessageBox, 0, addr dtbufI, addr AppNameI, MB_OK; Swiss Time - Itailan GMT+1
invoke MessageBox, 0, addr dtbufR, addr AppNameR, MB_OK; Swiss Time - Romanish(DNW) GMT+1
invoke StdOut, addr crlf
invoke StdOut, addr dtbufEb; England or United Kingdom
invoke StdOut, addr Putc
invoke StdOut, addr crlf
invoke StdOut, addr dtbufCb; CANADA - Eastern
invoke StdOut, addr Pedt
invoke StdOut, addr crlf
invoke StdOut, addr dtbufQb; CANADA, PQ - Eastern(French)
invoke StdOut, addr Pedt
invoke StdOut, addr crlf
invoke StdOut, addr dtbufGb; Swiss - German
invoke StdOut, addr Pcet
invoke StdOut, addr crlf
inkey " << Wait For Space Bar or Any Key >> ", 13, 10
exit
ret
start endp
align 8
end_here:
END start
; You Can Find this file at D:\masm32\bin\SWISS.ASM
That's all folks!
Hi herge,
thank you for the code. You should assemble it and put the sources together with the running application into a ZIP archive. It's better for testing.
Gunther
Hi Gunther:
Thanks for your ideas.
I had to cheat to get the AM|PMs to go in French so I used
The UK LCID, The time for Western Europe is a Kludge but it
works, It will be intresting if it works at next time change in
October. It's four hour time diffference between EDT and GMT it's
usually five hours,
I would like to get the Romanish to work, I think it should be 2072,
or 2073, but I have had no luck so far?
Also can you check if there use AM/PM or is it some thing else in
French, German, or Italian.
I suspect you will have to use unicode for Japan and other Easr Asian
countries.
Hi Gunther:
I have updated swiss.asm and added zeroHour routine to make the
midnight hour 0 a 12. It took almost an hours time first I was using
the wrong SYSTEMTIME, and then jumping out on Zero instead of
Not Zero.
zeroHour proc uses eax
; ESI > stm if midnight hour change 0 to 12
mov ax, word ptr [esi+08]; get Hour
and ax, ax
jnz @F
mov ax,12
mov [esi+8], ax
@@:
ret
zeroHour endp
Have to call zeroHour after you get Time and before you Format it!
; SWISS.ASM 11:46 AM 6/23/2008
; Modified Friday, July 17, 2015 1:44:02 AM
; SUBSYSTEM:CONSOLE
; Program displays the Time in Switzerland.
;
include \masm32\include\masm32rt.inc
;
; Remove Zero At End of Buffer MACRO. X is End or Exit
;
remzeroXbuf MACRO BufName:REQ
lea esi, offset BufName
add esi, eax
mov byte ptr [ esi - 1 ], " "
ENDM
.data
public stm, stmC
stm SYSTEMTIME<>
;typedef struct _SYSTEMTIME { // st
; WORD wYear; +00
; WORD wMonth; +02
; WORD wDayOfWeek; + 04
; WORD wDay; +06
; WORD wHour; +08
; WORD wMinute; + 10
; WORD wSecond; +12
; WORD wMilliseconds; +14
;} SYSTEMTIME;
stmC SYSTEMTIME<>; CANADA
lcidCAN dd 4105
lcidPQ dd 3084 ; Quebec
lcidUK dd 2057 ; UK
lcidSF dd 4108 ; Swiss French
lcidSG dd 2055 ; Swiss German
lcidSI dd 2064 ; Swiss italian
lcidSR dd 2073 ; Swiss Romanish(DNW) Does Not Work!
lcidFRA dd 1036 ; France
lcidGER dd 1031 ; Germany
lcidITA dd 1040 ; Italy
lcidSPA dd 1034 ; Spain
dd 0
public dtbufE, dtbufF, dtbufG, dtbufI, dtbufR
db 0
dtbufCb db " "; Space
dtbufC db 260 dup(0); Canada(4105)
dw 0
db 0
dtbufQb db " "
dtbufQ db 260 dup(0); CANADA (Quebec) 3084
db 0
dtbufEb db " "; Space
dtbufE db 260 dup(0); England UTC(2057)
dw 0
dtbufF db 260 dup(0); Swiss French(4108)
dw 0
db 0
dtbufGb db " "; Space
dtbufG db 260 dup(0); Swiss German(2055)
dw 0
dtbufI db 260 dup(0); Swiss italian(2064)
dw 0
dtbufR db 260 dup(0); Swiss Romanish(2072)
dw 0
db 0
dtbufSb db " "
dtbufS db 260 dup(9); Spain Spanish(3082)
dw 0
AppName db "Date & Time in Switzerland ", 0
AppNameC db "Date & Time in Ottawa, Ontario, CANADA ", 0
AppNameE db "Date & Time in London, England ", 0
AppNameF db "Date & Time in Geneva - French Suisse ",0
AppNameG db "Date & Time in Zurich - German Schweiz ",0
AppNameI db "Date & Time in Switzerland - Italian Svizzera ", 0
AppNameQ db "Date & Time in Montreal, PQ, CANADA ", 0
AppNameR db "Date & Time in Switzerland - Romanish ", 0
AppNameS db "Date & Time in Madrid, Spain - Spanish ", 0
crlf db 13, 10, 0
tf db "HH':'mm':'ss tt", 0
dtError db " << waitExit >> ", 13, 10, 7, 0
Putc db " UTC ", 13, 10, 0
Pbst db " BST ", 13, 10, 0
Pedt db " EDT ", 13, 10, 0
Pcest db " CEST ", 13, 10, 0
db 0
align 8
.code
zeroHour proc uses eax
; ESI > stm if midnight hour change 0 to 12
mov ax, word ptr [esi+08]; get Hour
and ax, ax
jnz @F
mov ax,12
mov [esi+8], ax
@@:
ret
zeroHour endp
insertTime proc
push esi
mov esi, offset stm
call zeroHour
pop esi
INVOKE GetTimeFormat, 2057, TIME_FORCE24HOURFORMAT, addr stm, addr tf, esi, 32
; 2057 UK to get AM/PM??
ret
insertTime endp
align 8
insertTimeC proc
push esi
mov esi, offset stmC
call zeroHour
pop esi
INVOKE GetTimeFormat, lcidCAN, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
ret
insertTimeC endp
align 8
insertTimeQ proc
push esi
mov esi, offset stmC
call zeroHour
pop esi
INVOKE GetTimeFormat, lcidUK, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
ret
insertTimeQ endp
align 8
; DI >s to Buffer Output
; SI >s to Source Input
; Make sure Direction Flag is UP!
CopyUntilNull proc
lodsb
stosb
and al, al
jnz CopyUntilNull
ret
CopyUntilNull endp
align 8
start proc
invoke GetLocalTime, addr stmC
invoke GetDateFormat, lcidCAN, DATE_LONGDATE, addr stmC, 0, addr dtbufC, sizeof dtbufC
and eax, eax
jz ErGDFCanada
remzeroXbuf dtbufC
call insertTimeC
mov esi, offset dtbufC
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pedt
call CopyUntilNull
invoke GetDateFormat, lcidPQ, DATE_LONGDATE, addr stmC, 0, addr dtbufQ, sizeof dtbufQ
and eax, eax
jz ErGDFQuebec
remzeroXbuf dtbufQ
call insertTimeQ
mov esi, offset dtbufQ
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pedt
call CopyUntilNull
invoke GetSystemTime, addr stm; Get UTC
; Kludge to get BST
mov ax, stm.wHour
cmp ax, 23
jnz @F
xor ax, ax
jmp saveAX
@@:
inc ax
public saveAX
saveAX::
mov stm.wHour, ax
invoke GetDateFormat, lcidUK , DATE_LONGDATE, addr stm, 0, addr dtbufE, sizeof dtbufE
and eax, eax
jz ErGDFEnglish
remzeroXbuf dtbufE
call insertTime
mov esi, offset dtbufE
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pbst
call CopyUntilNull
mov ax, stm.wHour; This is a Kludge to get Swiss Time
; or European Time i e France, Germany, Italy
inc ax; GET UTC +1 i e CET
mov stm.wHour, ax
invoke GetDateFormat, lcidSF , DATE_LONGDATE, addr stm, 0, addr dtbufF, sizeof dtbufF; was lcidSF
and eax, eax
jz ErGDFFrench
remzeroXbuf dtbufF
call insertTime
mov esi, offset dtbufF
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
invoke GetDateFormat, lcidGER , DATE_LONGDATE, addr stm, 0, addr dtbufG, 260; was lcidSG
and eax, eax
jz ErGDFGerman
remzeroXbuf dtbufG
call insertTime
mov esi, offset dtbufG
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
invoke StdOut, addr dtbufGb
invoke GetDateFormat, lcidITA, DATE_LONGDATE, addr stm, 0, addr dtbufI, 260; was lcidSI
and eax, eax
jz ErGDFItalian
remzeroXbuf dtbufI
call insertTime
invoke GetDateFormat, lcidSPA , DATE_LONGDATE, addr stm, 0, addr dtbufS, 260
and eax, eax
jz ErGDFSpain
public SpainTime
SpainTime::
remzeroXbuf dtbufS
call insertTime
mov esi, offset dtbufS
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
jmp NoError
ErGDFCanada:
invoke StdOut, addr crlf
print " << GetDateFormat Canada >> ", 13, 10, 7
jmp waitExit
ErGDFQuebec:
invoke StdOut, addr crlf
print " << GetDateFormat Quebec >> ", 13, 10, 7
jmp waitExit
ErGDFEnglish:
invoke StdOut, addr crlf
print " << GetDateFormat English >> ", 13, 10, 7
jmp waitExit
ErGDFFrench:
invoke StdOut, addr crlf
print " << GetDateFormat French >> ", 13, 10, 7
jmp waitExit
ErGDFGerman:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat German >> ", 13, 10, 7
jmp waitExit
ErGDFItalian:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat Italian >> ", 13, 10, 7
jmp waitExit
ErGDFRomanish:
invoke StdOut, addr crlf
print " << GetDateFormat Romanish >> ", 13, 10, 7
jmp waitExit
ErGDFSpain:
invoke StdOut, addr crlf
print " << GetDateFormat Spain >> ", 13, 10, 7
waitExit:
INVOKE MessageBox, 0, addr dtError, addr AppName, MB_OK
NoError:
invoke MessageBox, 0, addr dtbufC, addr AppNameC, MB_OK; CANADA Time GMT-4
invoke MessageBox, 0, addr dtbufQ, addr AppNameQ, MB_OK; Quebec Time GMT-4
invoke MessageBox, 0, addr dtbufE, addr AppNameE, MB_OK; England Time GMT+0
invoke MessageBox, 0, addr dtbufF, addr AppNameF, MB_OK; Swiss Time - French GMT+1
invoke MessageBox, 0, addr dtbufG, addr AppNameG, MB_OK; Swiss Time - German GMT+1
invoke MessageBox, 0, addr dtbufI, addr AppNameI, MB_OK; Swiss Time - Itailan GMT+1
invoke MessageBox, 0, addr dtbufS, addr AppNameS, MB_OK; Spanish Time - Spanish GMT+1
invoke StdOut, addr crlf
invoke StdOut, addr dtbufEb; England or United Kingdom
invoke StdOut, addr Putc
invoke StdOut, addr crlf
invoke StdOut, addr dtbufCb; CANADA - Eastern
invoke StdOut, addr crlf
invoke StdOut, addr dtbufQb; CANADA, PQ - Eastern(French)
invoke StdOut, addr crlf
invoke StdOut, addr dtbufGb; Swiss - German
invoke StdOut, addr crlf
invoke StdOut, addr dtbufSb; Spain - Spanish
invoke StdOut, addr crlf
inkey " << Wait For Space Bar or Any Key >> ", 13, 10
invoke StdOut, addr crlf
exit
ret
start endp
align 8
end_here:
END start
; You Can Find this file at D:\masm32\bin\SWISS.ASM
Regards Herge
Hello Gunther:
I am having trouble seeing the screen and the color on my screen is beginning
to go so.
swiss.asm with brighter white text.
; SWISS.ASM 11:46 AM 6/23/2008
; Modified Saturday, July 18, 2015 1:26:49 AM
; SUBSYSTEM:CONSOLE
; Program displays the Time in Switzerland.
;
include \masm32\include\masm32rt.inc
;
; Remove Zero At End of Buffer MACRO. X is End or Exit
;
remzeroXbuf MACRO BufName:REQ
lea esi, offset BufName
add esi, eax
mov byte ptr [ esi - 1 ], " "
ENDM
.data
public stm, stmC
stm SYSTEMTIME<>
;typedef struct _SYSTEMTIME { // st
; WORD wYear; +00
; WORD wMonth; +02
; WORD wDayOfWeek; + 04
; WORD wDay; +06
; WORD wHour; +08
; WORD wMinute; + 10
; WORD wSecond; +12
; WORD wMilliseconds; +14
;} SYSTEMTIME;
stmC SYSTEMTIME<>; CANADA
lcidCAN dd 4105
lcidPQ dd 3084 ; Quebec
lcidUK dd 2057 ; UK
lcidSF dd 4108 ; Swiss French
lcidSG dd 2055 ; Swiss German
lcidSI dd 2064 ; Swiss italian
lcidSR dd 2073 ; Swiss Romanish(DNW) Does Not Work!
lcidFRA dd 1036 ; France
lcidGER dd 1031 ; Germany
lcidITA dd 1040 ; Italy
lcidSPA dd 1034 ; Spain
dd 0
public dtbufE, dtbufF, dtbufG, dtbufI, dtbufR
db 0
dtbufCb db " "; Space
dtbufC db 260 dup(0); Canada(4105)
dw 0
db 0
dtbufQb db " "
dtbufQ db 260 dup(0); CANADA (Quebec) 3084
db 0
dtbufEb db " "; Space
dtbufE db 260 dup(0); England UTC(2057)
dw 0
dtbufF db 260 dup(0); Swiss French(4108)
dw 0
db 0
dtbufGb db " "; Space
dtbufG db 260 dup(0); Swiss German(2055)
dw 0
dtbufI db 260 dup(0); Swiss italian(2064)
dw 0
dtbufR db 260 dup(0); Swiss Romanish(2072)
dw 0
db 0
dtbufSb db " "
dtbufS db 260 dup(9); Spain Spanish(3082)
dw 0
AppName db "Date & Time in Switzerland ", 0
AppNameC db "Date & Time in Ottawa, Ontario, CANADA ", 0
AppNameE db "Date & Time in London, England ", 0
AppNameF db "Date & Time in Geneva - French Suisse ",0
AppNameG db "Date & Time in Zurich - German Schweiz ",0
AppNameI db "Date & Time in Switzerland - Italian Svizzera ", 0
AppNameQ db "Date & Time in Montreal, PQ, CANADA ", 0
AppNameR db "Date & Time in Switzerland - Romanish ", 0
AppNameS db "Date & Time in Madrid, Spain - Spanish ", 0
crlf db 13, 10, 0
tf db "HH':'mm':'ss tt", 0
dtError db " << waitExit >> ", 13, 10, 7, 0
Putc db " UTC ", 13, 10, 0
Pbst db " BST ", 13, 10, 0
Pedt db " EDT ", 13, 10, 0
Pcest db " CEST ", 13, 10, 0
db 0
.code
align 8
SetTextColor proc fore:DWORD,back:DWORD
LOCAL hStdOut:DWORD
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov hStdOut,eax
mov eax,back
shl eax,4
or eax,fore
invoke SetConsoleTextAttribute,hStdOut,eax
ret
SetTextColor endp
align 8
zeroHour proc uses eax
; ESI > stm if midnight hour change 0 to 12
mov ax, word ptr [esi+08]; get Hour
and ax, ax
jnz @F
mov ax,12
mov [esi+8], ax
@@:
ret
zeroHour endp
insertTime proc
push esi
mov esi, offset stm
call zeroHour
pop esi
INVOKE GetTimeFormat, 2057, TIME_FORCE24HOURFORMAT, addr stm, addr tf, esi, 32
; 2057 UK to get AM/PM??
ret
insertTime endp
align 8
insertTimeC proc
push esi
mov esi, offset stmC
call zeroHour
pop esi
INVOKE GetTimeFormat, lcidCAN, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
ret
insertTimeC endp
align 8
insertTimeQ proc
push esi
mov esi, offset stmC
call zeroHour
pop esi
INVOKE GetTimeFormat, lcidUK, TIME_FORCE24HOURFORMAT, addr stmC, addr tf, esi, 32
ret
insertTimeQ endp
align 8
; DI >s to Buffer Output
; SI >s to Source Input
; Make sure Direction Flag is UP!
CopyUntilNull proc
lodsb
stosb
and al, al
jnz CopyUntilNull
ret
CopyUntilNull endp
align 8
start proc
invoke SetTextColor, 15, 0
invoke GetLocalTime, addr stmC
invoke GetDateFormat, lcidCAN, DATE_LONGDATE, addr stmC, 0, addr dtbufC, sizeof dtbufC
and eax, eax
jz ErGDFCanada
remzeroXbuf dtbufC
call insertTimeC
mov esi, offset dtbufC
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pedt
call CopyUntilNull
invoke GetDateFormat, lcidPQ, DATE_LONGDATE, addr stmC, 0, addr dtbufQ, sizeof dtbufQ
and eax, eax
jz ErGDFQuebec
remzeroXbuf dtbufQ
call insertTimeQ
mov esi, offset dtbufQ
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pedt
call CopyUntilNull
invoke GetSystemTime, addr stm; Get UTC
; Kludge to get BST
mov ax, stm.wHour
cmp ax, 23
jnz @F
xor ax, ax
jmp saveAX
@@:
inc ax
public saveAX
saveAX::
mov stm.wHour, ax
invoke GetDateFormat, lcidUK , DATE_LONGDATE, addr stm, 0, addr dtbufE, sizeof dtbufE
and eax, eax
jz ErGDFEnglish
remzeroXbuf dtbufE
call insertTime
mov esi, offset dtbufE
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pbst
call CopyUntilNull
mov ax, stm.wHour; This is a Kludge to get Swiss Time
; or European Time i e France, Germany, Italy
inc ax; GET UTC +1 i e CET
mov stm.wHour, ax
invoke GetDateFormat, lcidSF , DATE_LONGDATE, addr stm, 0, addr dtbufF, sizeof dtbufF; was lcidSF
and eax, eax
jz ErGDFFrench
remzeroXbuf dtbufF
call insertTime
mov esi, offset dtbufF
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
invoke GetDateFormat, lcidGER , DATE_LONGDATE, addr stm, 0, addr dtbufG, 260; was lcidSG
and eax, eax
jz ErGDFGerman
remzeroXbuf dtbufG
call insertTime
mov esi, offset dtbufG
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
invoke StdOut, addr dtbufGb
invoke GetDateFormat, lcidITA, DATE_LONGDATE, addr stm, 0, addr dtbufI, 260; was lcidSI
and eax, eax
jz ErGDFItalian
remzeroXbuf dtbufI
call insertTime
invoke GetDateFormat, lcidSPA , DATE_LONGDATE, addr stm, 0, addr dtbufS, 260
and eax, eax
jz ErGDFSpain
public SpainTime
SpainTime::
remzeroXbuf dtbufS
call insertTime
mov esi, offset dtbufS
@@:
lodsb
and al, al
jnz @B
dec esi
mov edi, esi
mov esi, offset Pcest
call CopyUntilNull
jmp NoError
ErGDFCanada:
invoke StdOut, addr crlf
print " << GetDateFormat Canada >> ", 13, 10, 7
jmp waitExit
ErGDFQuebec:
invoke StdOut, addr crlf
print " << GetDateFormat Quebec >> ", 13, 10, 7
jmp waitExit
ErGDFEnglish:
invoke StdOut, addr crlf
print " << GetDateFormat English >> ", 13, 10, 7
jmp waitExit
ErGDFFrench:
invoke StdOut, addr crlf
print " << GetDateFormat French >> ", 13, 10, 7
jmp waitExit
ErGDFGerman:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat German >> ", 13, 10, 7
jmp waitExit
ErGDFItalian:
invoke StdOut, addr crlf
print 13,10," << GetDateFormat Italian >> ", 13, 10, 7
jmp waitExit
ErGDFRomanish:
invoke StdOut, addr crlf
print " << GetDateFormat Romanish >> ", 13, 10, 7
jmp waitExit
ErGDFSpain:
invoke StdOut, addr crlf
print " << GetDateFormat Spain >> ", 13, 10, 7
waitExit:
INVOKE MessageBox, 0, addr dtError, addr AppName, MB_OK
NoError:
invoke MessageBox, 0, addr dtbufC, addr AppNameC, MB_OK; CANADA Time GMT-4
invoke MessageBox, 0, addr dtbufQ, addr AppNameQ, MB_OK; Quebec Time GMT-4
invoke MessageBox, 0, addr dtbufE, addr AppNameE, MB_OK; England Time GMT+0
invoke MessageBox, 0, addr dtbufF, addr AppNameF, MB_OK; Swiss Time - French GMT+1
invoke MessageBox, 0, addr dtbufG, addr AppNameG, MB_OK; Swiss Time - German GMT+1
invoke MessageBox, 0, addr dtbufI, addr AppNameI, MB_OK; Swiss Time - Itailan GMT+1
invoke MessageBox, 0, addr dtbufS, addr AppNameS, MB_OK; Spanish Time - Spanish GMT+1
invoke StdOut, addr crlf
invoke StdOut, addr dtbufEb; England or United Kingdom
invoke StdOut, addr Putc
invoke StdOut, addr crlf
invoke StdOut, addr dtbufCb; CANADA - Eastern
invoke StdOut, addr crlf
invoke StdOut, addr dtbufQb; CANADA, PQ - Eastern(French)
invoke StdOut, addr crlf
invoke StdOut, addr dtbufGb; Swiss - German
invoke StdOut, addr crlf
invoke StdOut, addr dtbufSb; Spain - Spanish
invoke StdOut, addr crlf
inkey " << Wait For Space Bar or Any Key >> ", 13, 10
invoke StdOut, addr crlf
exit
ret
start endp
align 8
end_here:
END start
; You Can Find this file at D:\masm32\bin\SWISS.ASM
Regards Herge