Changeset 18098 for trunk/Ohana/src/opihi/pcontrol/IDops.c
- Timestamp:
- Jun 12, 2008, 12:52:06 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/IDops.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/IDops.c
r8296 r18098 1 1 # include "pcontrol.h" 2 2 3 static IDtype CurrentJobID = 0;4 static IDtype CurrentHostID = 0;3 static IDtype CurrentJobID = 1; 4 static IDtype CurrentHostID = 1; 5 5 6 /* for now, no persistence : we could use the date/time to seed the upper byte(s) if needed */ 6 /* for now, no persistence between sessions : we could use the date/time to seed the upper 7 * byte(s) if needed */ 7 8 void InitIDs () { 8 CurrentJobID = 0;9 CurrentHostID = 0;9 CurrentJobID = 1; 10 CurrentHostID = 1; 10 11 } 11 12 … … 41 42 } 42 43 44 IDtype GetID (char *IDword) { 45 46 int Nargs; 47 IDtype ID; 48 unsigned int word0, word1, word2, word3; 49 char *endptr; 50 51 Nargs = sscanf (IDword, "%x.%x.%x.%x", &word3, &word2, &word1, &word0); 52 if (Nargs == 4) { 53 IDtype tmp; 54 ID = 0; 55 ID |= (word0 << 0); 56 ID |= (word1 << 16); 57 tmp = word2; 58 ID |= (tmp << 32); 59 tmp = word3; 60 ID |= (tmp << 48); 61 return ID; 62 } 63 64 ID = strtoll (IDword, &endptr, 10); 65 if (*endptr == 0) { 66 return ID; 67 } 68 69 return 0; 70 }
Note:
See TracChangeset
for help on using the changeset viewer.
