Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > struct tm timeb

Reply
Thread Tools

struct tm timeb

 
 
Jeff Kish
Guest
Posts: n/a
 
      11-27-2006
I'm using an old compiler.
Can someone tell me if there is a way to convert from a struct tm to a timeb?

Not sure how to go about it. It is a really old app I'm working with.
thanks
Jeff
Jeff Kish
 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      11-27-2006

"Jeff Kish" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm using an old compiler.
> Can someone tell me if there is a way to convert from a struct tm to a
> timeb?
>
> Not sure how to go about it. It is a really old app I'm working with.
> thanks


You'll need to check your compiler's documentation.
Standard C++ does not have a type 'timeb'.

-Mike


 
Reply With Quote
 
 
 
 
Jeff Kish
Guest
Posts: n/a
 
      11-27-2006
On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler" <(E-Mail Removed)> wrote:

>
>"Jeff Kish" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>> I'm using an old compiler.
>> Can someone tell me if there is a way to convert from a struct tm to a
>> timeb?
>>
>> Not sure how to go about it. It is a really old app I'm working with.
>> thanks

>
>You'll need to check your compiler's documentation.
>Standard C++ does not have a type 'timeb'.
>
>-Mike
>

sigh. thanks. this is really old...
I think standard C does. Is this an area where C++ won't work with some C
calls?

Is there a recommended way to get from these sort of C time structures to C++?


Jeff Kish
 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      11-27-2006
Jeff Kish wrote:
> On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler"
> <(E-Mail Removed)> wrote:
>
>>
>> "Jeff Kish" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> I'm using an old compiler.
>>> Can someone tell me if there is a way to convert from a struct tm
>>> to a timeb?
>>>
>>> Not sure how to go about it. It is a really old app I'm working
>>> with. thanks

>>
>> You'll need to check your compiler's documentation.
>> Standard C++ does not have a type 'timeb'.
>>
>> -Mike
>>

> sigh. thanks. this is really old...
> I think standard C does. Is this an area where C++ won't work with
> some C calls?


Standard C does *not* have 'timeb'.

> Is there a recommended way to get from these sort of C time
> structures to C++?


Post your code, post your requirements (or what the code used to do)
and we can help you figure it out.

Usually to get a C type into C++ you just drop the decoration (like
in your case 'struct tm' becomes 'tm').

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
Larry Smith
Guest
Posts: n/a
 
      11-27-2006
Jeff Kish wrote:
> I'm using an old compiler.
> Can someone tell me if there is a way to convert from a struct tm to a timeb?
>
> Not sure how to go about it. It is a really old app I'm working with.
> thanks
> Jeff
> Jeff Kish


'timeb' was used by the old BSD ftime() function.
The same basic info can be obtained by creating
a 'tm' struct using ISO 9899 gmtime() or localtime().
For example:

#include <time.h>

struct tm * pTm;
struct tm tmNow;

pTm = localtime( time(0) );

/* if got the time, make a copy before another thread
* changes the global used by localtime().
* on unix, use the thread-safe localtime_r() instead.
*/
if (pTm)
tmNow = *pTm;
else
/* localtime() error */


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Typedef A references struct B which references struct A which... DanielEKFA C++ 8 05-16-2005 10:26 AM
struct in struct Gunnar G C++ 14 06-02-2004 06:43 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM
implementing a templated struct within a templated struct RA Scheltema C++ 3 01-06-2004 11:25 AM



Advertisments