Hello,

Is there any API to convert DWORD time value to user readable format? I know there are lots of routines that convert FileTime to SystemTime and that sorts of APIs but none that I know of that deals with only one DWORD value.

I mean that usri3_last_logon is like MSDN says:
Specifies a DWORD value that indicates when the last logon occured. This value is stored as the number of seconds that have elapsed since 00:00:00, January 1, 1970, GMT.

This big number of seconds doesn't tell much. So I'm wondering is there API to convert this to something meaningfull and user friendly format. Or is the only way to make my own conversion routine?

Sami
Posted on 2001-09-03 08:34:56 by SamiP
Well, I don't think there is an API for this, but it's not so hard to do this from your own when you know the seconds.
Posted on 2001-09-03 16:35:58 by Vom-bonjour:-()
It ain't no api, but:
Posted on 2001-09-03 21:29:07 by eet_1024
There is the localtime function in the c runtime library.
Posted on 2001-09-04 01:41:24 by Dr. Manhattan
Please, Karim, could you tell me how to use that localtime function? Is it some DLL that I use or what/how? I don't know C very well :(

Sami
Posted on 2001-09-04 08:15:16 by SamiP
I figured out how to use that localtime function. I found out that it resides in msvcrt.dll, but next question is; is that dll distributed with every windows? With every windows I mean 95/98/ME/NT4/2000/XP, so that I don't need to distribute it with my prog, because it makes my little prog huge.

Sami
Posted on 2001-09-04 11:01:32 by SamiP
Sorry, I only have Win98SE. I have msvcrt.dll in my windows\system\directory but I don't know if it was installed by VC++ or Windows :confused:
Posted on 2001-09-04 11:36:00 by Dr. Manhattan
Same problem here, I have Win2000 and msvcrt.dll in system32 folder, but is it installed by windows or by some other program?

Does anybody know?

Sami
Posted on 2001-09-04 12:58:58 by SamiP
There's a GetLocalTime api function. It fills out a structure with the date and time info.
Posted on 2001-09-04 13:18:41 by Sloat
Yep, GetLocalTime get systems current time.

Problem is: I use NetUserGetInfo to get USER_INFO_3 structure. In USER_INFO_3 structure there are two interesting variables usri3_last_logon and usri3_last_logoff both are DWORD size and have value of seconds starting from 1.1.1970. So I get two huge seconds values.

I need to convert those second values to something that user can understand.

As Karim suggested there is localtime function in msvcrt.dll, and I have successfully used that function to convert seconds to understandable format. Now I want to know is that msvcrt.dll part of windows or do I need to distribute it myself.

I think that doing a conversion routine by myself is too complicated, because of leapyears and that kind of things.

Sami
Posted on 2001-09-04 13:34:51 by SamiP