Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   struct tm timeb (http://www.velocityreviews.com/forums/t458732-struct-tm-timeb.html)

Jeff Kish 11-27-2006 02:13 PM

struct tm timeb
 
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

Mike Wahler 11-27-2006 03:47 PM

Re: struct tm timeb
 

"Jeff Kish" <jeff.kish@mro.com> wrote in message
news:njslm21lplh375n5uk883b8jgrkierfid3@4ax.com...
> 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



Jeff Kish 11-27-2006 03:53 PM

Re: struct tm timeb
 
On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler" <mkwahler@mkwahler.net> wrote:

>
>"Jeff Kish" <jeff.kish@mro.com> wrote in message
>news:njslm21lplh375n5uk883b8jgrkierfid3@4ax.com.. .
>> 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

Victor Bazarov 11-27-2006 04:19 PM

Re: struct tm timeb
 
Jeff Kish wrote:
> On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler"
> <mkwahler@mkwahler.net> wrote:
>
>>
>> "Jeff Kish" <jeff.kish@mro.com> wrote in message
>> news:njslm21lplh375n5uk883b8jgrkierfid3@4ax.com...
>>> 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



Larry Smith 11-27-2006 11:55 PM

Re: struct tm timeb
 
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 */




All times are GMT. The time now is 07:05 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.