Connect Middleware for NTP like algorithm