473,379 Members | 1,542 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,379 software developers and data experts.

Timestamp header

Hi all
I want to create a timestamp header in my program which keeps track of
the event number and the exp.num.
Can anyone plz provide a C program to do one such.
The header is of 1byte and 2 bits for the exp number and remaining for
the event number.
Thanks in advance
sriram
Nov 13 '05 #1
1 2138

"sriram" <sr********@yahoo.com> wrote in message

I want to create a timestamp header in my program which keeps track > of the event number and the exp.num. Can anyone plz provide a C program to do one such.
The header is of 1byte and 2 bits for the exp number and remaining for
the event number.

I'm afraid that you are not specifying your problem very well.
By "byte" do you mean 8 bits? Or do you mean the smallest addressable unit
of memory on whatever architecture you happen to be running on?

What do you mean by "whatever remaining?" Do you mean that byte-2 bits
should be the event number?

Anyway, you probably want this

typedef struct
{
unsigned int expnum : 10;
unsigned int eventnum : 6;
} HEADER;

This will give you 10 bits for expnum, and 6 bits for eventnum.

If you really do mean "architecture-dependent minimum unit of addressable
memory" by byte, then unfortunately the problem becomes a lot more
complicated. You will have to mess about with the constant CHAR_BIT to make
the bitfields the right size.
Nov 13 '05 #2

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

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
1
by: Fidelita Munos | last post by:
Hello everyone! My hosting company has been playing with their servers and screwing up the timestamp. Is there any way I could get the timestamp from a third party server? Thanks, Fidelita
2
by: rong.guo | last post by:
Hello Group, I am having a really weird problem... Can anyone tell the difference between Query 1 and Query 2 below? Why Query 2 excludes '2/28/2005'? Many thanks! create table a...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
22
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same...
7
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
0
by: bughunter | last post by:
Local server C:\TRACE>db2level DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106". Informational tokens are "DB2 v8.1.11.973", "s060120",...
0
by: =?Utf-8?B?ZWQ=?= | last post by:
I had this exact problem using a vb.net client accessing a Java web service. The solution takes 3 steps: 1.) Create custom ClientOutputFilter 2.) Create a custom Assertion that uses filter from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.