# compiler: add definitions and arguments to the compiler
 add_definitions(
-    -Werror -Wall -Wextra -Weffc++ -O2 -DVERSION_STRING=${VERSION}
+    -Wall -Wextra -Weffc++ -Wshadow -Wcast-qual -Wconversion -pedantic
+    -Werror -O2
+    -DVERSION_STRING=${VERSION}
     -DPROJECT_NAME=\"${PROJECT_NAME}\"
 )
 
 
 #include <ostream>
 
 #include <boost/bind.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
 
 #include "icmp/icmpchecksumcalculator.h"
 #include "icmp/icmpdata.h"
 using boost::asio::io_service;
 using boost::asio::ip::address;
 using boost::asio::ip::icmp;
+using boost::date_time::time_resolution_traits_adapted64_impl;
 using boost::posix_time::microsec_clock;
 using boost::posix_time::ptime;
 using boost::posix_time::seconds;
     uint16_t sequence_number = icmp_hdr.get_sequence_number();
     int ttl = ipv4_hdr.get_time_to_live();
     ptime now = microsec_clock::universal_time();
-    int elapsed_time = (now - TimeSent).total_milliseconds();
+    time_resolution_traits_adapted64_impl::int_type elapsed_time =
+            (now - TimeSent).total_milliseconds();
 
     cout << bytes_received << " bytes "
          << "from " << remote_address
 
 #include "icmp/icmpmessagepayload.h"
 
+#include <limits>
+
 #include <boost/assert.hpp>
 
 using namespace std;
         const int right_byte
 ) const
 {
-    return ( Payload[ left_byte ] << 8 ) + Payload[ right_byte ];
+    int value = ( Payload[ left_byte ] << 8 ) + Payload[ right_byte ];
+
+    BOOST_ASSERT( ( 0 <= value ) && ( value <= numeric_limits<uint16_t>::max() ) );
+
+    return static_cast<uint16_t> ( value );
 }
 
 void IcmpMessagePayload::encode(
 
 #include "icmp/ipv4header.h"
 
+#include <limits>
+
 using namespace std;
 using boost::asio::ip::address_v4;
 
 
 uint16_t Ipv4Header::get_header_length() const
 {
-    return ( Payload[ 0 ] & 0xF ) * 4;
+    return static_cast<uint16_t> ( (Payload[ 0 ] & 0xF) * 4 );
 }
 
 uint8_t Ipv4Header::get_type_of_service() const
 
 uint16_t Ipv4Header::decode( int left_byte, int right_byte ) const
 {
-    return ( (Payload[ left_byte ] << 8) + Payload[ right_byte ] );
+    int value = ( Payload[ left_byte ] << 8 ) + Payload[ right_byte ];
+
+    BOOST_ASSERT( ( 0 <= value ) && ( value <= numeric_limits<uint16_t>::max() ) );
+
+    return static_cast<uint16_t> ( value );
 }