TM1637(Digital tube) + DS1307 + DHT11

I want to display clock, temperature and humidity on a 4digit 7segment display module (tm1637 chip) - . The RTC is DS1307 and the temp. and humidity sensor is DHT11 . Can anyone help me with the code? I got separate code for displaying clock and another for temp and humidity, but dont know how to combine them. My Arduino is Mega and Ive connected Dht11 sensor like its shown in the link and the RTC on SDA (20) and SCL (21) pins. The two codes are working great separately.