Recording of CTime Object Serge Potteck -- serge@lune.cst.cnes.fr Friday, August 23, 1996 Environment : VC++ 1.51, Windows 3.11. What is put on the disk by CTime time; ar< Gerry Sweeney -- gerry@hornbill.com Tuesday, August 27, 1996 Environment : VC++ 1.51, Windows 3.11. Serge, I am not to sure if I understand your question but here goes. When you archive a CTime object, a 32 bit number of type 'time_t' which is basically a 'long'. This holds the number of seconds since January 1, 1970. See the help on the 'C' runtime library function 'time()'. As for the different computers, A MAC and a PC for example use different processors. (MAC use Motorola, PC use Intel). These processors store there numbers in memory in different order. This is known as big-endian and little-endian. Because the serialize() function in MFC writes a binary copy of a 'time_t' variable as a sequence of 32 bits this file would not work between computers with processors using different endian formats. One way around this is to convert the CTime object to a string and then store it. For example void CBoo::Serialize(CArchive ar) { if(ar.IsStoring()) { // ar << time; char buff[34]; CString tmp = _ltoa(tim.GetTime(), buff, 10); ar << tmp; } else { // ar >> time; CString tmp; time = (time_t)_atol((const char *)tmp); } } This would store the time as a string representation of the time value. I am not sure of the 'time()' runtime functions on different platforms have the same base time. You could store the time in a format like 'ddmmyyyyhhmmss' and use sscanf to get the information back. This would be pretty portable. I do hope this is the sort of thing you were looking for. If I have misunderstood your question please forgive me Gerry Sweeney ---------- From: owner-mfc-l To: mfc-l Subject: Recording of CTime Object Date: 23 August 1996 17:18 Environment : VC++ 1.51, Windows 3.11. What is put on the disk by CTime time; ar< pjn -- pjn@indigo.ie Tuesday, September 03, 1996 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ Gerry Sweeney -- gerry@hornbill.com Friday, September 06, 1996 Environment : VC++ 1.51, Windows 3.11. I do not know if that is the case, but even if it is it should not matter. We have not reached a time that would effect this. We are on appx 0x3*******. The most significant bit is used to indicate a (-)negative number so It should make no difference. Gerry ---------- From: owner-mfc-l To: mfc-l Subject: Re: Recording of CTime Object Date: 03 September 1996 20:28 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ | Вернуться в корень Архива |
Serge Potteck -- serge@lune.cst.cnes.fr Friday, August 23, 1996 Environment : VC++ 1.51, Windows 3.11. What is put on the disk by CTime time; ar< Gerry Sweeney -- gerry@hornbill.com Tuesday, August 27, 1996 Environment : VC++ 1.51, Windows 3.11. Serge, I am not to sure if I understand your question but here goes. When you archive a CTime object, a 32 bit number of type 'time_t' which is basically a 'long'. This holds the number of seconds since January 1, 1970. See the help on the 'C' runtime library function 'time()'. As for the different computers, A MAC and a PC for example use different processors. (MAC use Motorola, PC use Intel). These processors store there numbers in memory in different order. This is known as big-endian and little-endian. Because the serialize() function in MFC writes a binary copy of a 'time_t' variable as a sequence of 32 bits this file would not work between computers with processors using different endian formats. One way around this is to convert the CTime object to a string and then store it. For example void CBoo::Serialize(CArchive ar) { if(ar.IsStoring()) { // ar << time; char buff[34]; CString tmp = _ltoa(tim.GetTime(), buff, 10); ar << tmp; } else { // ar >> time; CString tmp; time = (time_t)_atol((const char *)tmp); } } This would store the time as a string representation of the time value. I am not sure of the 'time()' runtime functions on different platforms have the same base time. You could store the time in a format like 'ddmmyyyyhhmmss' and use sscanf to get the information back. This would be pretty portable. I do hope this is the sort of thing you were looking for. If I have misunderstood your question please forgive me Gerry Sweeney ---------- From: owner-mfc-l To: mfc-l Subject: Recording of CTime Object Date: 23 August 1996 17:18 Environment : VC++ 1.51, Windows 3.11. What is put on the disk by CTime time; ar< pjn -- pjn@indigo.ie Tuesday, September 03, 1996 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ Gerry Sweeney -- gerry@hornbill.com Friday, September 06, 1996 Environment : VC++ 1.51, Windows 3.11. I do not know if that is the case, but even if it is it should not matter. We have not reached a time that would effect this. We are on appx 0x3*******. The most significant bit is used to indicate a (-)negative number so It should make no difference. Gerry ---------- From: owner-mfc-l To: mfc-l Subject: Re: Recording of CTime Object Date: 03 September 1996 20:28 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ | Вернуться в корень Архива |
Gerry Sweeney -- gerry@hornbill.com Tuesday, August 27, 1996 Environment : VC++ 1.51, Windows 3.11. Serge, I am not to sure if I understand your question but here goes. When you archive a CTime object, a 32 bit number of type 'time_t' which is basically a 'long'. This holds the number of seconds since January 1, 1970. See the help on the 'C' runtime library function 'time()'. As for the different computers, A MAC and a PC for example use different processors. (MAC use Motorola, PC use Intel). These processors store there numbers in memory in different order. This is known as big-endian and little-endian. Because the serialize() function in MFC writes a binary copy of a 'time_t' variable as a sequence of 32 bits this file would not work between computers with processors using different endian formats. One way around this is to convert the CTime object to a string and then store it. For example void CBoo::Serialize(CArchive ar) { if(ar.IsStoring()) { // ar << time; char buff[34]; CString tmp = _ltoa(tim.GetTime(), buff, 10); ar << tmp; } else { // ar >> time; CString tmp; time = (time_t)_atol((const char *)tmp); } } This would store the time as a string representation of the time value. I am not sure of the 'time()' runtime functions on different platforms have the same base time. You could store the time in a format like 'ddmmyyyyhhmmss' and use sscanf to get the information back. This would be pretty portable. I do hope this is the sort of thing you were looking for. If I have misunderstood your question please forgive me Gerry Sweeney ---------- From: owner-mfc-l To: mfc-l Subject: Recording of CTime Object Date: 23 August 1996 17:18 Environment : VC++ 1.51, Windows 3.11. What is put on the disk by CTime time; ar< pjn -- pjn@indigo.ie Tuesday, September 03, 1996 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ Gerry Sweeney -- gerry@hornbill.com Friday, September 06, 1996 Environment : VC++ 1.51, Windows 3.11. I do not know if that is the case, but even if it is it should not matter. We have not reached a time that would effect this. We are on appx 0x3*******. The most significant bit is used to indicate a (-)negative number so It should make no difference. Gerry ---------- From: owner-mfc-l To: mfc-l Subject: Re: Recording of CTime Object Date: 03 September 1996 20:28 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+ | Вернуться в корень Архива |
pjn -- pjn@indigo.ie Tuesday, September 03, 1996 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+
Gerry Sweeney -- gerry@hornbill.com Friday, September 06, 1996 Environment : VC++ 1.51, Windows 3.11. I do not know if that is the case, but even if it is it should not matter. We have not reached a time that would effect this. We are on appx 0x3*******. The most significant bit is used to indicate a (-)negative number so It should make no difference. Gerry ---------- From: owner-mfc-l To: mfc-l Subject: Re: Recording of CTime Object Date: 03 September 1996 20:28 On Fri, 23 Aug 1996 17:18:13 -0400, you wrote: >Environment : VC++ 1.51, Windows 3.11. > >What is put on the disk by > > CTime time; > ar< >depends on the processor you use. > >I could find two classes of processors understanding >eachother perfectly. The oldest computer >seems to belong to the same class, but I found >a very recent Pentium belonging to that class too. >It doesn't depend on the code you make (8086 or 386). > >With a parametre in the .ini file, it would >be easy to bypass the problem, if the shift >were constant. But it seems not to be, and >to depend on the application. > >I am very sorry, because that problem is >probably well known. But would >anybody accept to help me ? > >Thanks > >Serge Potteck >National space center >France > > > I was told by a friend of mine who used VC 1.0 that the single member variable that CTime wrapped changed from an unsigned long to a signed long from VC 1.0 to VC 1.5. If this is the case, then this might be the cause of the problem. Other than that, I have not came across other problems with CTime in this area. ''' @ @ +========================ooO-(_)-Ooo=================================+ | PJ Naughter | | | | Software Developer Email: pjn@indigo.ie | | Softech Telecom Tel: +353-1-2958384 | | Fax: +353-1-2956290 | | Author of DTime - A Collection URL: http://indigo.ie/~pjn | | of Date & Time classes for MFC | | | | Addr: 7 Woodford, Brewery Road, Blackrock, | | Co. Dublin, Republic of Ireland | +====================================================================+