Converting a Labview time into a string with Measurement Studio C++

In my Measurement Studio-based C++ application, I'll be sent a Labview
time in the format of a double, which I believe is seconds since 1904.
Does Measurement Studio for Visual C++ contain a function that will
convert that time value into a string format? I'd like to end up with
something like "hh:mm:ss:msec". I'm basically looking for the
equivalent of the Labview vi, "Format Time/Date String". If Measurement
Studio doesn't provide this, is there some other (hopefully simple) way
to do this?
I can request that the Labview application send me time in a string
format as well as a double; this will require several changes to the
Labview application sending the timestamp, but if that is a simpler
solution that's the option we'll take.
Thanks in advance,
Adam

Measurement Studio does not have a function for this, but you can do
this yourself by first converting from LV epoch (1/1/1904) to Unix
epoch(1/1/1970) and then using c runtime time functions
UNIXEpochOffset is the difference between the 2 epochs at GMT. To
convert to a UNIX system clock value, just subtract the sum of this
number and your time zone offset in seconds
lvTime is the value returned by LV timestamp
#define  UNIXEpochOffset 2082844800
int _tmain(int argc, _TCHAR* argv[])
    __int64 lvTime = 3214396284; //10:48:13.173 AM 11/9/2005
    //GMT offset for Central Time is -6 (3600 seconds). You will need to account for daylight savings time.
    int offset = -3600;
    time_t unixTime = lvTime - UNIXEpochOffset - offset;  
    struct tm *newtime = localtime(&unixTime);
    printf(asctime( newtime )); //prints out the time in a string format.
    return 0;
Bilal Durrani
NI

Similar Messages

  • How do you convert an Autocad drawing into a pdf with Acrobat X Standard?

    How do you convert an Autocad drawing into a pdf with Acrobat X Standard?

    Something to try -
    Having installed Acrobat Standard you have the Adobe PDF virtual printer installed.
    From your authoring application do a "file-print" and select the Adobe PDF printer rather than the attached local or network printer / plotter.
    Be well...

  • Connect CFP-2000 with Measurement Studio

    Hi, I haven't understood how to connect a CFT-2000 module with Measurement Studio and VC++.
    Can any one help me to find documentation and sample related this task?
    I'm  interested into this topics:
    - is it possible to manage a CFT-2000 ethernet device with MAX? In ordere to use that device can i use DAQmx?
    - which  kind of data I will recive over ethernet raw, scaled..
    - is it possible to select one particular board of AI?
    - is it possible to execute multiple applictions (LabView and  Measeurement Studio) connected with the same CFTP-2000 controller into one PC?
    Thanks

    Dear Bobby60,
    First of all I suggest you this FAQ.
    You can connect and configure cFP 2000 from MAX through NI-Field Point and Labview Real Time.
    You have to use Labview Real Time to program an application on the cFP 2000.
    Comms to Labview and Measurement Studio can be realized through OPC Shared Variable and TCP/IP. In the last option you will have to program your own server in labview RT and deal with multiple client stuff.
    Best Regards
    FiloP
    It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
    Richard P. Feynman

  • Compatibility of NI IMAQ with measurement studio

    I would like to know where the NI IMAQ driver software is compatible with measurement studio.

    Hello,
    NI-IMAQ driver and its API is fully compatible with Measurement Studio. If you have already installed NI-IMAQ with Measurement Studio support, see the following directory (default path) for shipping examples
    C:\Program Files\National Instruments\MeasurementStudio\CVI\samples\IMAQ
    Let me know if you have further questions on this.
    Regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • I am using IMAQ vision for Measurement Studio, Ver6.0 with Measurement Studio Base Package,Ver6.0(Professional Edition).Can I work in IMAQ Vision for Measurement studio, Ver6.0 If I upgrade Measurement studio to Enterprise Edition,ver8.0.1

    I am using IMAQ vision for Measurement Studio, Ver6.0 with Measurement Studio Base Package,Ver6.0(Professional Edition).Can I work in IMAQ Vision for Measurement studio, Ver6.0 If I upgrade Measurement studio to Enterprise Edition,ver8.0.1
    Thanks
    Biswajit

    Howdy Biswajit,
    The IMAQ and Vision ActiveX controls you are using with Visual Basic 6 do not install with Measurement Studio. They are installed when you install the IMAQ software and include support for Visual Studio 6. Upgrading to Measurement Studio 8.0.1 will have no effect on your IMAQ controls since they are not related to one another. Purchasing Measurement Studio Professional or Enterprise packages allows you Visual Studio 6 support for other ActiveX components. Refer to this link for a list of ActiveX components included in those packages. 
    If you are asking about using the ActiveX controls in .NET, then take a look at this KnowledgeBase entitled Do NI-IMAQ and NI Vision Support Microsoft Visual Studio .NET?
    Hope this clarifies things!
    Best Regards,
    Jonathan N.
    National Instruments

  • Time stamps to string with seconds

    Good Day
    Im writing a program for my DAQ system. Its required that my
    data is saved with hours, mins and secs. The get date/time
    string VI seems to only output a string with the date and with
    hours and minutes. 
    How would I include the seconds into the outputed string.
    Thank You for your time.

    The vi has an boolean input 'want seconds' default is FALSE. Wire a TRUE and your done
    For a more flexible output there is also the
    Format Date/Time String Function
    Owning Palette: String Functions
    Requires: Base Package
    Displays a timestamp value or a numeric value as time in the format you specify using time format codes. For example, %c displays locale-specific date/time. Time-related format codes include the following: %X (locale-specific time), %H (hour, 24-hour clock), %I (hour, 12-hour clock), %M (minute), %S (second), %<digit>u (fractional seconds with <digit> precision), and %p (a.m./p.m. flag). Date-related format codes include the following: %x (locale-specific date), %y (year within century), %Y (year including century), %m (month number), %b (abbreviated month name), %d (day of month), and %a (abbreviated weekday name).
    Details  
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Converting an Excel file into a CSV with the DI API

    Hello everyone,
    it's my first post and also my first project with SBO, As the topic's header implies I have to write a program which converts an excel sheet into a CSV file, I have been reading a little about the DI API, and I would like to have further information about how to use the DI to access file data and/or alter it, other than what is already listed in the tutorials.
    Thanks in advance.

    Hi Amin,
    Unfortunately I am not aware of any way to this using only the DI API, it will be neccesary to include some other APIs or manual work.
    Off the top of my head I can only think of two workarounds to this:
    - Using the recordset and Excel combined. Read all the data from one column in a table and write it to a column in an Excel file possibly using a loop. Once the process of copying all desired columns and their data is complete, save the file as .csv using the excel API. I'm afraid I don't have an example of this. (It also may be possible using Microsofts SMO or another database API rather than the recordset.)
    With this approach the drawback is it might take a long time to figure out and develop in the short term, but in the long term would save alot of manual work as it could be automatic.
    - The alternative is unfortunately a manual approach: Simply run a query on the table, and then copy all the values from a column and paste it into the excel file.
    This has no short term work but is alot of manual work in the long term.
    Hope this is useful,
    Regards,
    Niall

  • Input time into Pages document with Automator or Grammarian Pro

    Is there a way (VERY NEWBIE) to have Automator input the time into a Pages document when I press a function key or another key combination? Or can Automator do it with Grammarian Pro? I write all day, and inputing time can get tedious. I have tried all the help files on Automator and have even experimented but to no avail.
    Any help would be appreciated.
    Thanks, Paul

    Do you mean other than using Pages to input the time?
    Did you know about the Insert menu in Pages? In the Insert menu there is an option for "Date & Time…" that will allow you to insert it using various formats, and offers to update it every time the document is opened.
    If you want a keyboard shortcut for a menu item, then open System Preferences and go to the Keyboard & Mouse settings. In there, you can define your own keyboard shortcuts for menu items of a specific application or all applications.
    If a menu item has an ellipsis "..." then you'll likely need to type that as one character. You can either use the system wide Character Palette (often found in the Edit menu as "Special Characters…"), or you can simply type Option-; by holding the Option key and pressing the semicolon key.

  • Get stack trace into a string with CLDC

    I want to get the stack trace of an application into a string, so that I may print the stack trace elsewhere.
    CLDC api does not have a printStackTrace(PrintWriter pw) or printStackTrace(PrintStream ps) which is present in j2se.
    Could you please suggest another way in CLDC to obtain the stack trace into a string.

    Set System.err to your designated PrintStream and then call Throwable.printStackTrace().
    This will do what you desire.
    rob,

  • DataSocket SelectURL method fails with Measurement Studio and vista

    The application uses the datasocket .SelectURL method to browse compact fieldpoint OPC items but the following error is raised:
    System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
       at NationalInstruments.Net.Internal.Win32.IAxDataSocket.SelectURL(Object startUrl, Object title, Object options, Object filters)
       at NationalInstruments.Net.DataSocket.SelectUrl(String startUrl, String title, SelectOptions options, String filter)
       at NationalInstruments.Net.DataSocket.SelectUrl()
       at DrillSense.Sensors.Sensor.SelectURL() in C:\DrillSense VS2005\DrillSense\cls_Sensor.vb:line 309
    This method works with Windows XP Pro however.
    The Development Environment includes:
    MS Visual Studio 2008 with SP1
    Measurement Studio 8.5.0 for VS 2008
    Windows Vista Business
    Is there a workaround to browse OPC items?
    Thanks,
    Barrett

    Hi Barrett,
    I would like to verify that the PC with Vista installed can see the OPC item.  Do you have an alternative programming language which you can use to verify communication?  If not, you may try Measurement & Automation Explorer (MAX).  If you do not see the fieldpoint in MAX, I would try the suggestions outlined in this KnowledgeBase article.
    How to Network FieldPoint to a Host Computer with Ethernet
    It would also be helpful if you could provide a bit more information about your setup.  I'm particularly interested in what .NET language you are using within Visual Studio (C#, VB.NET, C++, etc.).  I may have to try and reproduce the behavior on my end, so if you could provide as much detail as possible it would be helpful.  Thanks Barrett! 
    Rod T.

  • Program DAQCard-AI-16XE-50 with Measurement studio

    Does DAQCard-AI-16XE-50 can works with a application created by Measurement studio? I have developed a data acquisition software base on PCI-MIO-16E-4, but I want swith the card to DAQCard-AI-16XE-50, it likes doesn't work, I don't known why?

    Thanks lots to Chris and RamziH,
    I have tested DAQCard-AI-16XE-50 on Max, it works fine all analog channels, the device nubmer is 1. So, in my program I am using this device number, checking the sample rate no more than 20kHz and no analog output function in my program, but it still doesn't works. Does CWAI works with DAQCard-AI-16XE-50? The DAQ driver version is 6.9.2.
    Thanks again.

  • How can I convert a U32 array into binary string?

    Hi
    I would like to find an efficient way to convert an array of 8192 U32 into a single binary string!!!
    the solution below  last 550 ms on an RT target to convert 8192 U32.
    The same code running on Labview (not RT) last 100ms. I don't understand why there is such a difference.
    I've tryed to replace the inner loop and convert by a format string whith U32 on entry and %032b as parameter but it lasted same time.
    Thanks a lot

    Your picture of your code didn't come through. You can't link to a picture that's on your computer, as a server on the internet cannot access your computer to display the picture for others to see. You have to upload the picture as an attachment. Then, if you want to actually display the picture in the message you have to edit your post, insert a picture, and when it asks for the URL you enter the URL of the picture. You can get the URL when viewing the message, as the link is within the message itself.
    As for your question, can you just use the TypeCast function?

  • Problems converting FILETIME date/time into MM/DD/YYYY format...

    Has anyone successfully converted a FILETIME date/time value into a MM/DD/YYYY format using ColdFusion? I am failing drastically, and it seems like an easy conversion.
    FILETIME format (details: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724284(v=vs.85).aspx) is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
    A database I'm working with has such values, and I want to display them in a user-friendly date format within my application.
    For example, one record is:
    13003368600
    The above number represents the following date and time:
    1/22/2013 @ 2:50 PM
    Sadly I know this only because the FILETIME value gets written to the database by a third-party application, and within that application I specify it in the MM/DD/YYYY format.
    Can anyone offer me some guidance, or better yet has anyone accomplished this already and want to share code?

    I did this, on cf9/linux, and it seemed to do the trick:
    <cfscript>
    Long = createObject("java","java.lang.Long");
    Date = createObject("java","java.util.Date");
    fileTimeToEpoch =
    // take pwdLastSet From Active Directory, it's in filetime
    pwdLastSet = JavaCast("long", Long.parseLong("130292682204519505"));
    // take filetime and turn it into epoch/java - 1970/1/1
    // http://www.silisoftware.com/tools/date.php - converted: jan 1, 1970 00:00 -00
    javaTime = JavaCast("long", pwdLastSet - 116444736000000000);
    // convert to milliseconds
    javaTime = JavaCast("long", javaTime / 10000);
    today = JavaCast("string", Date.init(javaTime));
    </cfscript>
    <cfdump var="#pwdLastSet#">
    <cfdump var="#javatime#">
    <cfdump var="#today#">

  • Slow to convert Oracle 11g XMLType into Java String or Document

    After retrieving a result set from an Oracle 11g database, it takes roughly 75 seconds to convert the XMLType (this is a structured XML Storage, registered with an xsd) into either a java String or Document. I'm using Java 1.6, have the xdb.jar and xmlparserv2.jar
    This xsd is <100 lines and the xml document is also <100 lines.
    Sample code:
    oracle.xdb.XMLType xml = oracle.xdb.XMLType.createXML((oracle.sql.OPAQUE)rset.getObject("XMLDATA"));
    the other way, but still took just as long:
    XMLType xml = (XMLType)rset.getObject("XMLDATA");
    xml.getStringVal();
    or
    org.w3c.dom.Document doc = xml.getDocument();
    either way of the above ways takes just as long.

    If I put this value into the database table, I can
    see only the date. Time part is missing. Is this the
    problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

  • Convert arrays of picture into JPEG string

    Hiya, 
    I have constructed a procedure to carry out some intensity analysis for my experiment.  I have chosen to use snap instead of grab, as I only need to acquire and analyse images in every 2-30 secs (low level acquisition).  I have created a time cycle for each snap shot.  However, I could not save my images, as every 30sec the process will stop and the error will occur.  At the moment, I have connected the picutre to an AVI create.vi, everytime I run the vi, an error occurs. 
    I would like to save all my images into the same directory without using grab and without LABVIEW asking me the file name every time I want to save an image.  I would be the most appreciated if someone could help me with the problem please??
    Attachments:
    Nearlyfinishcam15.vi ‏263 KB

    hello,
    Maybe this is not what you want. But if you wanna a way  of saving your snaps to a directory you can do a simple thing as simple as I show you in the pic attached. You just have to but that inside a case that's true in the period that you want. And then you connect something to the "pic number" control in order to give different names for every snap.
    I don't have time to analyze you .vi. But I think that it's very complicated. And worst than that it's that maybe not very well programmed and you might have some problems. You have several parts of the code that you don't garanty Dataflow. Pay attention to that.
    This it's only a few ideas.
    Best regards,
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    save pics.jpg ‏28 KB

Maybe you are looking for