Hi Manish Jee, Actually I am seeking to know how the clock ticks are read and then they are stored in the data structure. My problem is not to encode the total time-stamp with year, month and day information, but just deal with the 24 hours time. Normally time_t are of 32-bits or longer. And I am interested only in ways to encode 24 hours time i.e. 86400 seconds, which will not require all 32 bits as I can anticipate. And i need to reduce the storage requirements for my design ( actually it is a part in my academic project where I am trying to encode 24 hours time and a random number (value ranging from 0 to 100) within 2 bytes ). I am able to fit the 24 hours time i.e 86400 seconds by using up to 11 bits which leaves just 5 bits for storing the number i.e. values up to 0-31. Therefore i am trying to know how the clock ticks ( clock_t ) are read and how it is transferred into seconds by the system clock i.e. how the information in time_t is organized.
On Aug 25, 11:03 pm, Manish Regmi <[email protected]> wrote: > On Thu, Aug 25, 2011 at 1:11 AM, विदुर <[email protected]> wrote: > > Hi All, > > > I am wondering to learn about how the system clock (or software clock > > or kernel clock) represents/stores time. Particularly, I am searching > > for ways to represent one day time (24 hours = 24 * 60 * 60 seconds) > > in an storage efficient way i.e. by using as less as possible number > > of bits. > > I think some operating system books have the explanations but I am not > > able to recall it. Some insights or links to relevant sources/links > > are highly appreciated. > > > Thank You > > all posix complaint system uses gettimeofday(). see "man gettimeofday" > or related functions. > it gives number of seconds since EPOCH (00:00:00 UTC, January 1, 1970). > > but i did not understand where you are trying to store it. currently > it can be stored in "sizeof(struct timeval)" bytes. or just time_t if > you just need seconds. > may i know what exactly are you trying to do? -- FOSS Nepal mailing list: [email protected] http://groups.google.com/group/foss-nepal To unsubscribe, e-mail: [email protected] Mailing List Guidelines: http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines Community website: http://www.fossnepal.org/
