rbrown567

Time In Future error

Discussion created by rbrown567 on Feb 27, 2012
Latest reply on Mar 9, 2012 by charlie@osisoft.com

I get a TimeInFuture error, 0x80040765, when I execute the following code:

 

JNIEXPORT jboolean JNICALL Java_com_draper_smartgen_PiConnector_setPiValueFloat
  (JNIEnv *env, jobject obj, jstring serverName, jstring tagName, jfloat newValue, jdouble timeStamp)
{
    _bstr_t bServerName,bTagName;
   
    const char *tag = env->GetStringUTFChars(tagName, 0);
    const char *server = env->GetStringUTFChars(serverName, 0);
   
    bServerName = server;
    bTagName = tag;
   

    CoInitialize(NULL);
   
    try {
        IPISDKPtr pPISDK(__uuidof(PISDK));
        ServersPtr pServers;
        ServerPtr pServer;

        pServers = pPISDK->Servers;
        pServer = pServers->Item[bServerName];
       
        PIPointsPtr pPiPoints;
        PIPointPtr pPoint;
       
        pPiPoints = pServer->PIPoints;
        pPoint = pPiPoints->Item[bTagName];
       
        float nv = newValue;

        pPoint->Data->UpdateValue(nv, "*", dmReplaceDuplicates, NULL);
       
    }
    catch(_com_error Err)
    {
        _tprintf(_T("Error:%s : 0x%x \n"),(TCHAR *)Err.Description(),Err.Error());
        return false;
    }
   
    CoUninitialize();
   
    env->ReleaseStringUTFChars(tagName, tag);
    env->ReleaseStringUTFChars(serverName, server);
    return true;
}

 

Why is this happening.

Outcomes