Author Topic: Getting local time information with C run-time functions  (Read 2897 times)

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 1711
Getting local time information with C run-time functions
« 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

Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: Getting local time information with C run-time functions
« Reply #1 on: October 23, 2013, 04:56:59 AM »
Erol,

good example. Thank you for providing it.

Gunther
Get your facts first, and then you can distort them.