The MASM Forum

Projects => Poasm => Topic started by: Vortex on October 23, 2013, 04:43:19 AM

Title: Getting local time information with C run-time functions
Post by: Vortex on October 23, 2013, 04:43:19 AM
Here is a quick sample :

Code: [Select]
include     LocalTimeCRT.inc

.data

format1     db 'Local time and date: %H:%M:%S %d-%m-%Y',0
format2     db 13,10,'Local time and date: %s',0

.data?

rawtime     dd ?
tminfo      dd ?
buffer      db 128 dup(?)

.code

start:

    invoke  time,ADDR rawtime
    invoke  localtime,ADDR rawtime
    mov     tminfo,eax

    invoke  strftime,ADDR buffer,128,ADDR format1,eax
    invoke  puts,ADDR buffer

    invoke  asctime,tminfo
    invoke  printf,ADDR format2,eax

    invoke  ExitProcess,0

END start
Title: Re: Getting local time information with C run-time functions
Post by: Gunther on October 23, 2013, 04:56:59 AM
Erol,

good example. Thank you for providing it.

Gunther