Re: A Question of How to Handle Numerical Notation
On Oct 6, 2006, at 4:26 AM, Martin McCormick wrote: Does anybody know what this notation is called? Does an explanation of the algorithm exist in public so one can convert the strings that are part of the call manager output in to the unsigned ints that actually carry the right values? An example of the string in question looks like: 370A65FA-6965-4E40-A0DA-EC88DE6B That sure looks like a UUID, which may or may not encode valid time information. See: http://en.wikipedia.org/wiki/UUID http://www.ietf.org/rfc/rfc4122.txt 4.1.4. Timestamp The timestamp is a 60-bit value. For UUID version 1, this is represented by Coordinated Universal Time (UTC) as a count of 100- nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar). For systems that do not have UTC available, but do have the local time, they may use that instead of UTC, as long as they do so consistently throughout the system. However, this is not recommended since generating the UTC from local time only needs a time zone offset. For UUID version 3 or 5, the timestamp is a 60-bit value constructed from a name as described in Section 4.3. For UUID version 4, the timestamp is a randomly or pseudo-randomly generated 60-bit value, as described in Section 4.4. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | time_low | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | time_mid| time_hi_and_version | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |clk_seq_hi_res | clk_seq_low | node (0-1)| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | node (2-5)| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: A Question of How to Handle Numerical Notation
Chuck Swiger writes: On Oct 6, 2006, at 4:26 AM, Martin McCormick wrote: Does anybody know what this notation is called? Does an explanation of the algorithm exist in public so one can convert the strings that are part of the call manager output in to the unsigned ints that actually carry the right values? That sure looks like a UUID, which may or may not encode valid time information. My thanks to you and to one other individual who have written responses to my questions. Both have suggested the same possibility that this is a UUID and not the data I am actually looking for. I will talk to the people who extracted the file and see if there is a possibility we got the wrong data in that field. One would hope that the time stamp data are normal 32-bit values that can be sucked in by a %lx in sscanf. Thank you. Martin McCormick WB5AGZ Stillwater, OK Systems Engineer OSU Information Technology Department Network Operations Group ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: A Question of How to Handle Numerical Notation
On Oct 6, 2006, at 11:21 AM, Martin McCormick wrote: My thanks to you and to one other individual who have written responses to my questions. You're welcome. I will talk to the people who extracted the file and see if there is a possibility we got the wrong data in that field. One would hope that the time stamp data are normal 32-bit values that can be sucked in by a %lx in sscanf. No, they aren't, but there is sample code at the end of RFC-4122 which you might want to review. In particular: typedef unsigned64_t uuid_time_t; void get_system_time(uuid_time_t *uuid_time) { struct timeval tp; gettimeofday(tp, (struct timezone *)0); /* Offset between UUID formatted times and Unix formatted times. UUID UTC base time is October 15, 1582. Unix base time is January 1, 1970.*/ *uuid_time = ((unsigned64)tp.tv_sec * 1000) + ((unsigned64)tp.tv_usec * 10) + I64(0x01B21DD213814000); } -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: A Question of How to Handle Numerical Notation Solved
Those of you who recognised the example string I sent as a UUID really helped solve this problem. What happened was that the algorithm I wrote to parse the CSV values in each record is broken when it encounters a blank field as in ,, so it fails to increase the index counter and place a null string at that point. This meant that what I was reading as field W was actually more like field Z. I was actually looking at a field labeled pkid or Packet ID which is the UUID you saw. The algorithm I wrote to parse worked perfectly on the first line of the file because every field was populated but it silently failed on lines of real data because of blank fields. Martin McCormick WB5AGZ Stillwater, OK Systems Engineer OSU Information Technology Department Network Operations Group ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]