Guest

Cable Modem Termination Systems (CMTS)

How to Calculate the Hexadecimal Value for DHCP Option 2 (time offset)

Document ID: 12188

Updated: Oct 04, 2005

   Print

Introduction

This document describes the procedure used in order to calculate the hexadecimal value for the time offset DHCP Option 2 when DHCP pools are configured in Cisco routers. This option is particularly important in cable environments.

The DHCP configurations option is available in many Cisco platforms, in particular in uBR7200, and all the other uBRs. Cisco routers that run a Cisco IOS® release of 12.0(1)T or later have the ability to act as DHCP servers.

When you use the Cisco IOS DHCP server, the time offset value for a particular time zone is specified as an unsigned 32 bit hexadecimal value.

There is a common misconception about the difference between the time offset and Network Time Protocol (NTP). NTP is used by machines on the Internet in order to synchronize with the UTC timescale. The acronym UTC is an English-French mixture for Coordinated Universal Time (or its equivalent Temps Universel Coordonne) in order to make it language independent. UTC is more precise than GMT because UTC measures time based on an atomic clock. Time offset is based on Greenwich Mean Time (GMT) which defines a second as 1/86400 of a day, which is not 100 percent accurate.

Prerequisites

Requirements

There are no specific requirements for this document.

Components Used

This document is not restricted to specific software and hardware versions.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

Examples of How to Calculate the Hexadecimal Value of Time Offset

In these examples:

Symbol Meaning
* Multiplication
/ Division
^ Power

First Example

If a cable modem is used in a region that is GMT +11 hours, the appropriate value is calculated with these steps:

  1. The number of seconds equivalent to 11 hours = 11 hours * (60 minutes / hour) * (60 seconds / minute) = 39600 seconds.

  2. With a scientific calculator or a tool, such as the calculator application included with Microsoft Windows, convert 39600 to a hexadecimal value. This is 9AB0.

  3. The value placed in the DHCP pool configuration now becomes option 2 hex 0000.9AB0.

Second Example

If a cable modem is used in a region that is GMT - 4 hours. In this case, the negative value changes the procedure. The appropriate value is calculated with these steps:

Note: 1hr = (60 minutes / hour) * (60 seconds / minute) = 3600 sec

  1. The number of seconds equivalent to - 4 hours = - 4 hours * (3600 second/hr) = - 14400 seconds.

  2. In order to convert -14400 to an unsigned 32 bit value, perform this operation: 2^32 means 2 to the power of 32 = 4294967296. Then, 2^32 - 14400 = 4294967296 - 14400 = 4294952896. This step is required because option 2 is 32 bits long.

  3. With a scientific calculator, or a tool such as the calculator application included with Microsoft Windows, convert 4294952896 to a hexadecimal value. This is FFFFC7C0.

  4. The value placed in the DHCP pool configuration now becomes option 2 hex FFFF.C7C0.

Third Example

This example is the same as the previous but step 2 is done in the scientific calculator from Microsoft Windows, without the need to calculate 2^32

Standard Pacific time is GMT -8. This is a simpler way to calculate GMT with negative values:

  1. The number of seconds equivalent to - 8 hours = - 8 hours * (3600 seconds / hr) = - 28800 seconds.

  2. With a scientific calculator, enter the number -28800 in the calculator with decimal values. The (-) sign is very important. In order to get the negative sign in front, press the +/- key.

  3. Choose Hex. This gives you FFFFFFFFFFFF8F80. This is because, by default, the calculator has Qword enabled.

  4. In order to get rid of the extra Fs, choose Dword. This produces the value FFFF8F80. If you do not have this option in your calculator, use only the first eight digits from right to left.

  5. The value placed in the DHCP pool configuration now becomes option 2 hex FFFF.8F80.

Table of Conversion of Different Offset Times into Hexadecimal

This table gives the conversion of the different time zones around the world. The hexadecimal values are set to have a fixed length of 32 bits as specified in Option 2 of the DHCP RFC 2132. For a world timezone map, refer to World Time Zone Map leavingcisco.com.

GMT offset (in hr) GMT offset in seconds GMT offset in Hexadecimal
0 0 0000.0000
+1 3600 0000.0E10
+2 7200 0000.1C20
+3 10800 0000.2A30
+4 14400 0000.3840
+5 18000 0000.4650
+6 21600 0000.5460
+7 25200 0000.6270
+8 28800 0000.7080
+9 32400 0000.7E90
+10 36000 0000.8CA0
+11 39600 0000.9AB0
+12 43200 0000.A8CD
-1 -3600 FFFF.F1F0
-2 -7200 FFFF.E3E0
-3 -10800 FFFF.D5D0
-4 -14400 FFFF.C7CD
-5 -18000 FFFF.B9B0
-6 -21600 FFFF.ABA0
-7 -25200 FFFF.9D90
-8 -28800 FFFF.8F80
-9 -32400 FFFF.8170
-10 -36000 FFFF.7360
-11 -39600 FFFF.6550

Related Information

Updated: Oct 04, 2005
Document ID: 12188