// Path: modules/postgres/app/edu/berkeley/ground/postgres/start/ApplicationStart.java
// @Singleton
// public class ApplicationStart {
// 
//   private final Instant start;
// 
//   @Inject
//   public ApplicationStart(Clock clock, ApplicationLifecycle appLifecycle, final Configuration configuration, final Database dbSource)
//     throws GroundException {
// 
//     this.start = clock.instant();
//     Logger.info("Ground Postgres: Starting application at " + this.start);
// 
//     Logger.info("Queries will Cache for {} seconds.", configuration.underlying().getString("ground.cache.expire.secs"));
//     System.setProperty("ground.cache.expire.secs", configuration.underlying().getString("ground.cache.expire.secs"));
// 
//     appLifecycle.addStopHook(
//       () -> {
//         Instant stop = clock.instant();
//         Long runningTime = stop.getEpochSecond() - this.start.getEpochSecond();
//         Logger.info("Ground Postgres: Stopping application at " + clock.instant() + " after " + runningTime + "s.");
//         return CompletableFuture.completedFuture(null);
//       });
//   }
// }


import com.google.inject.AbstractModule;
import edu.berkeley.ground.postgres.start.ApplicationStart;
import java.time.Clock;

public class Module extends AbstractModule {

  @Override
  public void configure() {
    bind(Clock.class).toInstance(Clock.systemDefaultZone());
// Path: modules/postgres/app/edu/berkeley/ground/postgres/start/ApplicationStart.java
// @Singleton
// public class ApplicationStart {
// 
//   private final Instant start;
// 
//   @Inject
//   public ApplicationStart(Clock clock, ApplicationLifecycle appLifecycle, final Configuration configuration, final Database dbSource)
//     throws GroundException {
// 
//     this.start = clock.instant();
//     Logger.info("Ground Postgres: Starting application at " + this.start);
// 
//     Logger.info("Queries will Cache for {} seconds.", configuration.underlying().getString("ground.cache.expire.secs"));
//     System.setProperty("ground.cache.expire.secs", configuration.underlying().getString("ground.cache.expire.secs"));
// 
//     appLifecycle.addStopHook(
//       () -> {
//         Instant stop = clock.instant();
//         Long runningTime = stop.getEpochSecond() - this.start.getEpochSecond();
//         Logger.info("Ground Postgres: Stopping application at " + clock.instant() + " after " + runningTime + "s.");
//         return CompletableFuture.completedFuture(null);
//       });
//   }
// }


// Path: modules/postgres/app/Module.java
import com.google.inject.AbstractModule;
import edu.berkeley.ground.postgres.start.ApplicationStart;
import java.time.Clock;


public class Module extends AbstractModule {

  @Override
  public void configure() {
    bind(Clock.class).toInstance(Clock.systemDefaultZone());
    bind(ApplicationStart.class).asEagerSingleton();