News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Getting local time information with C run-time functions

Started by Vortex, October 23, 2013, 04:43:19 AM

Previous topic - Next topic

Vortex

Here is a quick sample :

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

Gunther

Erol,

good example. Thank you for providing it.

Gunther
You have to know the facts before you can distort them.