[Openroad-users] WindowsAPI call to GetLocalTime
gareth.2.edwards at bt.com
gareth.2.edwards at bt.com
Tue Apr 22 21:44:32 EST 2008
I remember a while back replicating a VB structure within ORd for use
with the FindFirstFileA procedure. The only problem is i cannot for the
life of me remember (it was a good few years ago) how i came up with
this solution.
Here is the code to use that procedure and maybe it will shed some light
on how to get GetLocalTime working?!
i4BytePadder = INTEGER NOT NULL; // Integer byte boundary used
for structures
{
/*
** Call the 3GL procedure to find the file according to the parameters
given.
** An object cannot be byrefd to a 3GL procedure, so individual byte
padders had to be used to meet the byte boundaries, as structures are
not currently supported in ORd 4.1
*/
ReturnStatus = FindFirstFileA
(
CurObject.Filepath + CurObject.Filename,
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(i4BytePadder),
BYREF(CurObject.FoundFilename)
);
Cheers,
Gareth Edwards
BT Global Services
t: +44 (0)131 300 1907
e: Gareth.2.Edwards at BT.com <mailto:gareth.2.edwards at bt.com>
________________________________
From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Darren Mason
Sent: Tuesday, April 22, 2008 2:51 AM
To: 'International OpenROAD Users'; 'OpenRoad Users Group'
Subject: Re: [Openroad-users] WindowsAPI call to GetLocalTime
Hi Fabian, you are spot on.
This is a continuation of the thread from a fortnight or so ago.
When the eClient is installed across timezones we have adopted the
approach of defaulting the timezone to the same one on the server
regardless of location. This means the DATE('now') will return the
date time as it is exist on the server and not as it is on the client
PC. Given we are recording when employees start and finish work it is
critical to get the time from the local PC.
What appeared to be the simple answer was to do a windows API
call however we have not got it working yet - we are still getting
spurious results.
If anyone has this call working and can provide some sample code
this would be greatly appreciated! We try to avoid calling VB / .NET
routines unless absolutely necessary in an effort to keep our code
portable across all operating systems (although we are not there yet...)
however if this has been done and can be shared that would be great.
Regards
Darren Mason
MyWorkplace Solutions Pty Limited
Level 5, 11 Queens Road
Melbourne Victoria 3004
Ph. 1300 733 731
Mob. 0419 337 170
Fax. 03 9710 1112
Making Service our Priority
www.MyWorkplace.com.au
If you receive this email by mistake, please notify us and do
not make any use of the email. We do not waive any privilege,
confidentiality or copyright associated with it.
From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Fabian
Anderson
Sent: Tuesday, 22 April 2008 11:24 AM
To: International OpenROAD Users; OpenRoad Users Group
Subject: Re: [Openroad-users] WindowsAPI call to GetLocalTime
Hi Bill,
The main reason (for me) was so that the time-zone
info could come from the client environment and not the server.
I think the requirement called for a time with time-zone
applied, but the problem was that it needed to have the correct
time-zone applied.
Regards,
Fabian.
________________________________
From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Bill Allan
Sent: Monday, 21 April 2008 7:10 PM
To: International OpenROAD Users; OpenRoad Users Group
Subject: Re: [Openroad-users] WindowsAPI call to GetLocalTime
Can I ask a stupid question?
Why do you need to use 'GetLocalTime'? Ingres
DATE_GMT(DATE('now')) will give you a GMT ( UTC) string that can be cut
up and give you all the information apart from the Milliseconds
component.
In Ingres 2006 there is a new ANSI DATE data type which has a
number of good features. Here is part of the doco:
TIME WITH TIME ZONE hh:mm:ss.ffff... [+|-]th:tm 12:45:12.23456
-05:00
TIME or TIME WITHOUT TIME ZONE hh:mm:ss.ffff... 12:45:12.23456
other formats are:
ANSIDATE
TIME WITH LOCAL TIME ZONE
TIMESTAMP WITH TIME ZONE
TIMESTAMP or TIMESTAMP WITHOUT TIME ZONE
TIMESTAMP WITH LOCAL TIME ZONE
INTERVAL YEAR TO MONTH
INTERVAL DAY TO SECOND
Having the Timezone with ANSI DATE just tells you what the
offset from GMT isat that instant. It doesn't tell you the timezone
name.
Bill Allan.
----- Original Message -----
From: jade clements
<mailto:jade.clements at myworkplace.com.au>
To: OpenRoad Users Group
<mailto:openroad-users at sealion.peerlessit.com>
Sent: Monday, April 21, 2008 12:18 PM
Subject: [Openroad-users] WindowsAPI call to
GetLocalTime
Hello,
I'm using a Window's API call, GetLocalTime, to obtain
the user's pc time however I'm getting some weird results.
procedure zGetTime ( ) =
declare
wYear = INTEGER NOT NULL;
wMonth = INTEGER NOT NULL;
wDayOfWeek = INTEGER NOT NULL;
wDay = INTEGER NOT NULL;
wHour = INTEGER NOT NULL;
wMinute = INTEGER NOT NULL;
wSecond = INTEGER NOT NULL;
wMilliseconds = INTEGER NOT NULL;
enddeclare
{
CALLPROC GetLocalTime(
byref(wYear),
byref(wMonth),
byref(wDayOfWeek),
byref(wDay),
byref(wHour),
byref(wMinute),
byref(wSecond),
byref(wMilliseconds));
CurProcedure.TRACE(
'Year: ' + VARCHAR(wYear) +
' Mth: ' + VARCHAR(wMonth) +
' Day: ' + VARCHAR(wDay) +
' Hr: ' + VARCHAR(wHour) +
' Min: ' + VARCHAR(wMinute) +
' Sec: ' + VARCHAR(wSecond) +
' DOW: ' + VARCHAR(wDayOfWeek));
}
Result:
Year: 264152 Mth: 1376257 Day: 45023240 Hr: 0 Min: 0
Sec: 0 DOW: 917516
The Day value changes everytime the procedure is run.
The API guide mentions that the GetSystemTime function
returns the system time expressed in Coordinated Universal Time (UTC).
I guess the same goes for GetLocalTime however, the return values just
aren't right.
Can anyone help?
Regards
Jade Clements
MyWorkplace Solutions Pty Limited
Level 5, 11 Queens Road
Melbourne Victoria 3004
Ph: 1300 733 731
Making Service our Priority
www.MyWorkplace.com.au
If you receive this email by mistake, please notify us
and do not make any use of the email. We do not waive any privilege,
confidentiality or copyright associated with it.
________________________________
________________________________________________________________
OpenROAD-Users mailing list
You can maintain your subscription here:
http://www.peerlessit.com/mailman/listinfo/openroad-users
To unsubscribe click on this link
mailto:openroad-users-unsubscribe at peerlessit.com&subject=unsubscribe
To subscribe click on this link
mailto:openroad-users-subscribe at peerlessit.com&subject=subscribe
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security
System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________
Specialist providers of back and front office systems for the
financial services industry.
Featuring: Fintechnix(r)
Disclaimer:
Notice: This message contains privileged and confidential
information intended only for the use of the addressee named above. If
you are not the intended recipient of this message you are hereby
notified that you must not disseminate, copy or take any action in
reliance on it.
Any views expressed in this message are those of the individual
sender,except where the sender specifically states them to be the views
of Fintechnix Pty Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20080422/20b3f167/attachment.html
More information about the Openroad-users
mailing list