package io.finch.internal

import java.time.{Instant, ZoneId}
import java.time.format.DateTimeFormatter
import java.util.Locale


object currentTime {
  private[this] val formatter: DateTimeFormatter =
    DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz")
      .withLocale(Locale.ENGLISH)
      .withZone(ZoneId.of("GMT"))

  @volatile private[this] var last: (Long, String) = (0, "")

  def apply(): String = {
    val time = System.currentTimeMillis()
    if (time - last._1 > 1000) {
      last = time -> formatter.format(Instant.ofEpochMilli(time))
    }

    last._2
  }
}

package io.finch.internal

import java.time.format.DateTimeFormatter
import java.time.Instant
import java.time.ZoneOffset

object currentTime {
  private[this] val formatter: DateTimeFormatter =
    DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneOffset.UTC)

  @volatile private[this] var last: (Long, String) = (0, "")

  def apply(): String = {
    val time = System.currentTimeMillis()
    if (time - last._1 > 1000) {
      last = time -> formatter.format(Instant.ofEpochMilli(time))
    }

    last._2
  }
}

--- 
+++ 
@@ -1,12 +1,15 @@
 package io.finch.internal
 
+import java.time.{Instant, ZoneId}
 import java.time.format.DateTimeFormatter
-import java.time.Instant
-import java.time.ZoneOffset
+import java.util.Locale
+
 
 object currentTime {
   private[this] val formatter: DateTimeFormatter =
-    DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneOffset.UTC)
+    DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz")
+      .withLocale(Locale.ENGLISH)
+      .withZone(ZoneId.of("GMT"))
 
   @volatile private[this] var last: (Long, String) = (0, "")
 
Fix Date Header to conform to RFCs 7231 and 5322
