The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 FileTimeToSystemTime()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 08/11/2002 :  10:59:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
This function apparently return times that are relative to GMT. I live in the Eastern Time zone (w/DST), so file dates returned by the function are exactly 4 hours later than what Windows Explorer tells me. How can I (or any user in an arbitrary time zone) obtain local time from system time? Or from file time directly?

Mike Buess
Origin WebRing Member

cpyang

USA
1406 Posts

Posted - 08/11/2002 :  2:01:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We should provide better documentation on that issue, but here is a small program that shows you how,
 

bool show_file_time(LPCSTR lpcsFilename)
{
WIN32_FILE_ATTRIBUTE_DATA fileInfo;

if(GetFileAttributesEx(lpcsFilename, 0, &fileInfo))
{
FILETIME localFiletime;
if(FileTimeToLocalFileTime(&fileInfo.ftLastWriteTime, &localFiletime))
{
SYSTEMTIME sysTime;
if(FileTimeToSystemTime(&localFiletime, &sysTime))
{
printf("%s last modified at %.2d-%.2d-%4d %.2d:%.2d:%.2d\n",
lpcsFilename,
sysTime.wMonth,sysTime.wDay,sysTime.wYear,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
return TRUE;
}
}
}
return FALSE;
}

void tt(string strFilename)
{
if(!show_file_time(strFilename))
out_str("error");
}




you can try like

tt %Yfile.ogs

from script window


CP



Edited by - cpyang on 08/11/2002 2:02:20 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/11/2002 :  2:13:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
CP, Thanks.

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000