Ottenere con le risorse della libreria standard C 'time.h' la data nella forma 'giorno-della-settimana mese giorno ora:min:sec anno'
Vai alla navigazione
Vai alla ricerca
Con le funzioni esterne "time()" e "ctime()", contenute nella libreria standard C /usr/include/time.h, è possibile ottenere la data corrente nella forma stringa "giorno-della-settimana mese giorno ora:minuti:secondi anno".
Mostriamo un semplice esempio pratico:
Library "libc:6" ' time_t time (time_t *__timer) ' Return the current time and put it in *TIMER if TIMER is not NULL. Private Extern time_C(__timer As Pointer) As Long Exec "time" ' char *ctime (const time_t *__timer) ' Equivalent to `asctime (localtime (timer))'. Private Extern ctime(__timer As Pointer) As String Public Sub Main() Dim l As Long Dim s As String l = time_C(0) s = ctime(VarPtr(l)) Print s End