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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Timestamp

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Chris2 Posted - 02/04/2011 : 05:23:32 AM
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!

1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 02/07/2011 : 2:35:40 PM
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);    
}




The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000