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
 Timestamp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Chris2

20 Posts

Posted - 02/04/2011 :  05:23:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Win XP Professional
Origin 8.1

Hello,

is there any equivalent of the strptime-funktion of C to convert a given timestamp into seconds?

Hope you can help me!

easwar

USA
1965 Posts

Posted - 02/07/2011 :  2:35:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

So you have a string with time in some format and want to convert to number of seconds?

Maybe code like below is what you need?

See global functions for date, time related functions in Origin C:
http://ocwiki.originlab.com/index.php?title=Category:Date_Time_%28global_function%29

Easwar
OriginLab


void str_to_sec()
{
	// String containing time
    string strTime = "001:12:00:00.0"; // 1 day, 12 hrs, 0 mins, 0 secs

    // Convert time string to julian value
    double dTime = str_to_time(strTime);
    printf("Julain value of %s = %f\n", strTime, dTime);

    // Can multiply julian value by number of seconds in a day to get seconds
    const int NSECS_PER_DAY = 24*60*60;
    printf("Number of seconds= %f\n", dTime * NSECS_PER_DAY);    
}



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