Program: gdcm
Module: $RCSfile: gdcmCommon.h,v $
Language: C++
- Date: $Date: 2005/01/20 17:15:53 $
- Version: $Revision: 1.52 $
+ Date: $Date: 2005/01/21 19:51:12 $
+ Version: $Revision: 1.53 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
+typedef unsigned long uint64_t;
#define UINT32_MAX (4294967295U)
#endif
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2005/01/21 16:06:21 $
- Version: $Revision: 1.114 $
+ Date: $Date: 2005/01/21 19:51:12 $
+ Version: $Revision: 1.115 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
time_t *timep;
// We need implementation specific functions to obtain millisecond precision
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)
struct timeb tb;
::ftime(&tb);
timep = &tb.time;
// 3 OS: Win32, SunOS and 'real' POSIX
// http://groups-beta.google.com/group/comp.unix.solaris/msg/ad36929d783d63be
// http://bdn.borland.com/article/0,1410,26040,00.html
- unsigned char addr[6];
- std::string macaddr;
+ union dual { uint64_t n; unsigned char addr[6]; };
- int stat = GetMacAddrSys(addr);
- if (0 == stat)
+ // zero-initialize the whole thing first:
+ dual d = { 0 };
+ int stat = GetMacAddrSys(d.addr);
+ if (stat == 0)
{
- for (int i=0; i<6; ++i)
- {
- //macaddr += Format("%2.2x", addr[i]);
- if(i) macaddr += ".";
- macaddr += Format("%i", (int)addr[i]);
- }
- return macaddr;
+ // fill with zero to fit on 15 bytes.
+ return Format("%015llu", d.n);
}
else
{