Converting binary fields to time of day format

As stated above, the basic operations of a report program include formatting and printing data from SMF records. Many SMF records have timestamp fields that contain a binary value that represents the time since midnight, in hundredths of seconds. One example is the SMFxxTME field which exists in all SMF record headers and contains a value representing the time when the record was moved into the SMF buffer. Listed below are steps to follow in order to convert any timestamp into time of day format. For more detailed information on SMF record headers see Standard SMF record header.

Note that the DISPLAY and OCCUR operators on the z/OS® DFSORT ICETOOL utility include built in functions to convert the date and time. See z/OS DFSORT: Getting Started.

Example 1: Assume the time value in binary hundredths of a second past midnight is 005C5E00:

  1. Convert the value of the binary timestamp to a decimal value:
    1. 005C5E00 = 6053376
  2. Detemine the number of hours past midnight the timestamp was created:
    1. Divide the decimal value from step 1 by 100. The result is the number of seconds past midnight.
      6053376/100 = 60533.76
    2. Divide by the number of seconds in an hour to obtain the number of hours past midnight. There are 3600 seconds in an hour. For this example the hours portion of the time of day is equal to 16.
      60533.76/3600 = 16.814933333
    3. Determine the number of hundredths of a second in that number of hours.
      16 * 3600 * 100 = 5760000
    4. Subtract that number of hundredths of a second from the original decimal value.
      6053376 - 5760000 = 293376
    The remainder from step 2 is 293376.
  3. Determine the number of minutes past midnight the timestamp was created:
    1. Divide the remainder from step 2 by 100. This is the number of seconds past the hour.
      293376/100 = 2933.76
    2. Now divide your answer from part a by the number of seconds in a minute. The result is the number of minutes past the hour. In this example the minutes portion of the time of day is equal to 48.
      2933.76/60 = 48.896
    3. Determine the number of hundredths of a second in that number of minutes.
      48 * 60 * 100 = 288000
    4. Subtract that number of 100ths of a second from the remainder from step 2.
      293376 - 288000 = 5376
    The remainder from step 3 is 5376.
  4. Determine the number of seconds, tenths, and hundredths.
    1. Divide the remainder from step 3 by 100.
      5376/100 = 53.76

    Therefore, the actual time of day is 16:48:53.76.

Example 2: Assume the time value in binary hundredths of a second past midnight is 005D7740:

  1. Convert the value of the binary timestamp to a decimal value:
    1. 005D7740 = 6125376
  2. Detemine the number of hours past midnight the timestamp was created:
    1. Divide the decimal value from step 1 by 100. The result is the number of seconds past midnight.
      6125376/100 = 61253.76
    2. Divide by the number of seconds in an hour to obtain the number of hours past midnight. There are 3600 seconds in an hour. For this example the hours portion of the time of day is equal to 17.
      61253.76/3600 = 17.014933333
    3. Determine the number of hundredths of a second in that number of hours.
      17 * 3600 * 100 = 6120000
    4. Subtract that number of hundredths of a second from the original decimal value.
      6125376 - 6120000 = 5376
    The remainder from step 3 is 5376.
  3. Determine the number of minutes past midnight the timestamp was created:
    1. Divide the remainder from step 2 by 100. This is the number of seconds past the hour.
      5376/100 = 53.76
    2. Now divide your answer from part a by the number of seconds in a minute. The result is the number of minutes past the hour. In this example the minutes portion of the timestamp equal 0.
      53.76/60 = 0.896
    3. Determine the number of hundredths of a second in that number of minutes.
      0 * 60 * 100 = 0
    4. Subtract that number of 100ths of a second from the remainder from step 2.
      5376 - 0 = 5376
    The remainder from step 3 is 5376.
  4. Determine the number of seconds, tenths, and hundredths.
    1. Divide the remainder from step 3 by 100.
      5376/100 = 53.76

    Therefore, the actual time of day is 17:00:53.76.

Table 1 and Table 2 list the number of hundredths of a second in each full hour (0-24) and the number of hundredths of a second in each full minute (0-60) respectively. They may be used to make the calculations easier by finding the numbers that are just below the numbers calculated and subtracting them. See the examples following these tables.

Table 1. Number of hundredths of a second in each full hour of a day
Hundredths Of Seconds Hour
000000 0
360000 1
720000 2
1080000 3
1440000 4
1800000 5
2160000 6
2520000 7
2880000 8
3240000 9
3600000 10
3960000 11
4320000 12
4680000 13
5040000 14
5400000 15
5760000 16
6120000 17
6480000 18
6840000 19
7200000 20
7560000 21
7920000 22
8280000 23
8640000 24
Table 2. Number of hundredths of a second in each full minute of an hour
Hundredths of Seconds Minutes
000000 0
006000 1
012000 2
018000 3
024000 4
030000 5
036000 6
042000 7
048000 8
054000 9
060000 10
066000 11
072000 12
078000 13
084000 14
090000 15
096000 16
102000 17
108000 18
114000 19
120000 20
126000 21
132000 22
138000 23
144000 24
150000 25
156000 26
162000 27
168000 28
174000 29
180000 30
186000 31
192000 32
198000 33
204000 34
210000 35
216000 36
222000 37
228000 38
234000 39
240000 40
246000 41
252000 42
258000 43
264000 44
270000 45
276000 46
282000 47
288000 48
294000 49
300000 50
306000 51
312000 52
318000 53
324000 54
330000 55
336000 56
342000 57
348000 58
354000 59
360000 60

Example 3: Assume the time value in binary hundredths of a second past midnight is 005C5E00:

  1. Convert the value of the binary timestamp to a decimal value:
    1. 005C5E00 = 6053376
  2. Detemine the number of hours past midnight the timestamp was created:
    1. Find the value in Table 1 which is closest to, but less than, the decimal value in step 1. In our example, the hours portion of the timestamp is equal to 16.
      5760000		16
    2. Subtract the number of hundredths of a second from the original decimal value.
      6053376 - 5760000 = 293376
    The remainder from step 2 is 293376.
  3. Determine the number of minutes past midnight the timestamp was created:
    1. Find the value in Table 2 which is closest to, but less than, the remainder of step 2. In our example, the minutes portion of the timestamp is equal to 48.
      288000		48
    2. Subtract the number of hundredths of a second from the remainder of step 2.
      293376 - 288000 = 5376
    The remainder from step 3 is 5376.
  4. Determine the number of seconds, tenths, and hundredths.
    1. Divide the remainder from step 3 by 100.
      5376/100 = 53.76

    Therefore, the actual time of day is 16:48:53.76.