Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
916 and 920 calc issue
#1
This function (in a driver) used to work fine and somehow it stopped working. I just commented out the section of code awhile back because it wasn't working thinking I broke something. I've been fixing a few things lately and it doesn't work in the driver but works fine in the debugger.

I'm starting to think its not me. c8Diff is being returned as a huge value like 30744573450 instead of 10 or 5 minutes. When I run through the debugger, it works perfectly and logs values I would expect. When its run as a driver, it goes crazy.

This morning I upgraded from 916 to 920 thinking it was me, but maybe the bug was introduced in 916? Maybe I'm crazy?

Any ideas?

Code:
// Desc: Gets time difference from variable driver
    // Req: global m_fldIO, m_Time, and a current time set to m_c8TimeNow.
    Method getMinutes([In] String varName) Returns Card8  Begin
        Locals=
            Card8 c8VarTime;
            Card8 c8Diff;
        EndLocals;

        c8VarTime := m_FldIO.ReadTimeField("varDrv", varName);
        c8Diff := m_c8TimeNow - c8VarTime;
        c8Diff /= m_Time.kOneMinute;
        m_Log.LogMsg1("getMinDiff=%(1)", c8Diff);
        Return c8Diff;
    EndMethod;
--Kill all the serial ports--
Reply
#2
Is it because of times being out of sync on two machines? when you run it in the debugger perhaps the driver and var driver are on the same machine while in the regular scenario they aren't?

Who is writing the to the variable driver field to put a time in it? It would appear that it's coming out firther along than m_c8TimeNow. Of course you should probably update m_c8TimeNow after reading the field since you could create a situation where the field was written to just after this call was made (presumably the caller is setting the now member, and therefore it's past now.
Dean Roddey
Explorans limites defectum
Reply
#3
Its not because of two machines. I have one computer running CQC right now.

A macro is writing to the variable driver. Every time my driver loops m_c8TimeNow is updated to the current time (once per minute).

The time difference could be 5 minutes and it's still going crazy. I'm going to add more logging and see what happens.
--Kill all the serial ports--
Reply
#4
Presumably, the only way it could really happen is if it wraps around because now is before the variable time.
Dean Roddey
Explorans limites defectum
Reply
#5
I added some logging. Very strange. m_c8TimeNow is set the instant before c8VarTime gets read from the variable driver.

Code:
04/05 22:17:06-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCGenDrvS, MEng.User.CQC.Drivers.MyHome.DriverImpl.263, Status/App Status
    Running Poll method (runs : m_c8TimeNow := m_Time.GetStamp();)
}
04/05 22:17:06-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.43, Status/App Status
     c8Diff=18446744073522961616, (diff, way off because somehow varTime is higher than timenow!)
  c8VarTime=13652001855210000,   (motion sensor time)
m_c8TimeNow=13652001668620000    (time now as set above)
            
}

I checked in the variable driver, the time of the tMotionKitchen is like 20 minutes in the past. Whats also weird is that it works for the living room.

Now I ran a reconfigure on the driver, and its logging the same values over and over even though its a minute apart (see next log). I also made sure this was still in the poll method : m_c8TimeNow := m_Time.GetStamp();. Just to make sure I'm not crazy.


Code:
04/05 22:49:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCGenDrvS, MEng.User.CQC.Drivers.MyHome.DriverImpl.253, Status/App Status
    Running Poll method
}
04/05 22:49:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.43, Status/App Status
    c8Diff=565260000, c8VarTime=13652019822210000, m_c8TimeNow=13652020387470000
}
04/05 22:49:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.46, Status/App Status
    getMinDiff=0
}
04/05 22:49:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.63, Status/App Status
    Lights Kitchen Time Diff=0
}

04/05 22:50:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCGenDrvS, MEng.User.CQC.Drivers.MyHome.DriverImpl.253, Status/App Status
    Running Poll method
}
04/05 22:50:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.43, Status/App Status
    c8Diff=565260000, c8VarTime=13652019822210000, m_c8TimeNow=13652020387470000
}
04/05 22:50:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.46, Status/App Status
    getMinDiff=0
}
04/05 22:50:18-mosler, CQCServer, CQCDrv_myhomeThread6
{
    CQCKit, MEng.System.CQC.Runtime.CQCLogger.63, Status/App Status
    Lights Kitchen Time Diff=0
}
--Kill all the serial ports--
Reply
#6
I found a solution/workaround that appears to cause the desired result.

Changed the getMinutes method:
Code:
//c8Diff := m_c8TimeNow - c8VarTime;
        c8Diff := m_Time.GetStamp() - c8VarTime;

So, for some reason, when m_c8TimeNow is updated in the Poll method, its not working correctly for the getMinutes method.
--Kill all the serial ports--
Reply
#7
Oh, GetStamp() just gets the value of the time object. GetCurStamp() gets the current time. So you want to call GetCurStamp() to set the current time.
Dean Roddey
Explorans limites defectum
Reply
#8
Grrrrrrrrrrr. Thanks.
--Kill all the serial ports--
Reply
#9
I found a lot more GetStamp where it should be GetCurStamp in my code, yikes! Its a virus! I have a lot of find/replace to do. Strange that it has been working fine except for this one place.
--Kill all the serial ports--
Reply
#10
It's often amazing how long a seemingly deadly bug can survive uncaught.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  4.5.20 autogen calendar questions... this is just a curiusity thing...no issue per se SomeWhatLost 3 2,452 10-13-2014, 08:00 PM
Last Post: Dean Roddey
  Auto-Gen Issue Two finish.06 9 3,603 08-26-2014, 08:08 AM
Last Post: Dean Roddey
  Auto Gen Issue DaveB 6 2,917 08-22-2014, 07:36 AM
Last Post: dgilpin
  HttpClient issue resolving IP jkish 60 19,014 07-24-2013, 12:48 PM
Last Post: jkish
  918 AutoGen Issue Bugman 18 6,593 04-05-2013, 12:37 PM
Last Post: Bugman
  Timed field issue karenlee 6 2,851 02-21-2013, 03:47 AM
Last Post: karenlee
  3.3.6 driver issue rm1759 2 2,826 08-16-2010, 11:31 AM
Last Post: rm1759
  LAST issue I've found with Zoomplayer Roscoe62 0 1,758 05-03-2009, 12:31 AM
Last Post: Roscoe62
  2.0.11 IV issue, well maybe... might be something else... SomeWhatLost 11 5,562 01-27-2007, 01:42 PM
Last Post: Dean Roddey
  2.2.7 Theatertek driver issue I am having 0 579 Less than 1 minute ago
Last Post:

Forum Jump:


Users browsing this thread: 1 Guest(s)