473,413 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

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
Nov 27 '06 #1
4 6443

"Jeff Kish" <je*******@mro.comwrote in message
news:nj********************************@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
Nov 27 '06 #2
On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler" <mk******@mkwahler.netwrote:
>
"Jeff Kish" <je*******@mro.comwrote in message
news:nj********************************@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
Nov 27 '06 #3
Jeff Kish wrote:
On Mon, 27 Nov 2006 15:47:01 GMT, "Mike Wahler"
<mk******@mkwahler.netwrote:
>>
"Jeff Kish" <je*******@mro.comwrote in message
news:nj********************************@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
Nov 27 '06 #4
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 */
Nov 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Roy Hills | last post by:
When I'm reading from or writing to a network socket, I want to use a struct to represent the structured data, but must use an unsigned char buffer for the call to sendto() or recvfrom(). I have...
10
by: Rick Anderson | last post by:
All, I am receiving the following compilation error on LINUX (but not Solaris, HPUX, WIN32, etc): compiling osr.c LBFO.h(369): warning #64: declaration does not declare anything extern...
5
by: PCHOME | last post by:
Hello! I am working on dividing a single C file into several files. Now I encounter a problem about the global variables and can not find a way to solve it. All global variables and codes used...
19
by: Russell Shaw | last post by:
Hi, I have two structs in a header file, and they reference each other, causing a compile error. Is there a standard way to deal with this? typedef struct { ... RtAction *actions; }...
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
16
by: burn | last post by:
Hello, i am writing a program under linux in c and compile my code with make and gcc. Now i have 4 files: init.c/h and packets.c/h. Each header-file contains some: init.h: struct xyz {
4
by: PCHOME | last post by:
Hi! I have questions about qsort( ). Is anyone be willing to help? I use the following struct: struct Struct_A{ double value; ... } *AA, **pAA;
15
by: dutchgoldtony | last post by:
Hi all, I was just wondering if this is possible. I'm trying to implement a viterbi decoder in C and am creating an array of nodes (the struct), and an array of pointers to nodes (the member...
16
by: Zero | last post by:
Hi everybody! I have the following code: struct Infos { char Haarfarbe; int Groesse; }; struct Person
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.