4
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

see the functions in time.h -- such as time(0) will return the current time in seconds since 1970 (or something like that). Then localtime() will convert it to a structure tm. There is also a gmtime() that converts the time(0) to GMT instead of local time.

Votes + Comments
Nice succinct answer
0

hi...
i want to get local time stamp in format mmddhhmmsshh where last hh gives the hundreds of seconds.
if you have any idea reply me.
regards
wijitha

0

You have to format the stamp yourself from the information received from the functions Ancient Dragon suggested you look into.

0

hi...
i want to get local time stamp in format mmddhhmmsshh where last hh gives the hundreds of seconds.
if you have any idea reply me.
regards
wijitha

The functions in time.h will not give you milliseconds. For that you need to call other os-specific functions. For MS-Windows you can call the win32 api GetSystemTime() which fills in a structure for you and, on most Windows systems, will give you milliseconds. After you call that function you will have to format the information however you want it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.