The format of time_t in ints

From: Rasmus R\xnlev (raro94ab@hp4.econ.cbs.dk)
Date: 02/27/96


Hi all

Well, I keep banging my head into a wall while I'm constructing a pfile 
converter for a PL8 mud.

I've gotten some wierd problems..

In the char_file_u structure wich makes the lib/etc/players file, there 
is a field called played. It's of the format INT.

I use the host to net/net to host conversion routines from the 
librarutines called htons()/htonl() and ntohs()/ntohl().

These routines have transformed everything PERFECTTLY except this anoying 
thing showed it's ugly head.

In the char_file_u (st) the following field is causing me IMMENSE PROBLEMS:

st.played

and allso in the rent_info (rent) the following field is the same:

rent.time

Well, the idea of those field is to give some sort of TIME, i.e. when the 
objects were saved, and for how long the character has been playing.
They are both of the format INT, thus using 

st.played = htons(st.played);
rent.time = htons(rent.time);

and on the mashine i move from, and

st.played = ntohs(st.played);
rent.time = ntohs(rent.time);

on the mashine I convert it to should do the trick..

Unfortunately this isn't happening.. The st.played turns up as beeing 
0h 0m and the rentfiles get purged all a lot..

I'd appreciate if someone knew what to do about this, as it's getting on 
my nerves, and prohibiting me from moving the playerfiles to the new mashine.

It might be somethign about converting it with a (time_t) or something, 
but I honestly have no idea, and don't want to mess arround any further 
like a blind bat.. (not hat I don't like bats... but I hate beeng blind :)

Regards,
Con.

d.
--
***************************************************************************
*                            *    Visit my homepage:                      *
*   Rasmus Rønlev DOEK'94    *    http://www.econ.cbs.dk/people/raro94ab  *
*   Student instructor       *    Visit my Multi User Dungeon (MUD):      *
*                            *    ns3.ptd.net 5000 or 198.80.46.3 5000    *   
***************************************************************************
*                                                                         *
*      Student, B.Sc in Computer Science and Business Administration      *
*                                                                         *
***************************************************************************



This archive was generated by hypermail 2b30 : 12/07/00 PST