-- File: TimeServerDefs.Mesa,  Last Edit: HGM  February 10, 1981  6:15 PM

DIRECTORY
  InlineDefs USING [BcplLongNumber],
  TimeDefs USING [WestEast],
  Window USING [Handle],
  StatsDefs USING [StatCounterIndex],
  BufferDefs USING [PupBuffer],
  PupTypes USING [PupAddress, PupType],
  MiscServerDefs USING [
    dateTextRequest, dateTextIs, dateTenexRequest, dateTenexIs, dateAltoRequest,
    dateAltoIs, lockTimeRequest, lockTimeReply, resetTimeRequest, resetTimeReply,
    timeStatsRequest, timeStatsReply];

TimeServerDefs: DEFINITIONS =
  BEGIN

  PupTimeServerOn: PROCEDURE;
  PupTimeServerOff: PROCEDURE;
  SetupTimeServerThings: PROCEDURE;
  ResetTime: PROCEDURE [PupTypes.PupAddress];

  PupTimeServer: PROCEDURE [BufferDefs.PupBuffer];

  -- this is the network format, not the core format
  PupTimeFormat: TYPE = RECORD [
    time: InlineDefs.BcplLongNumber, -- word 0 and 1
    zoneS: TimeDefs.WestEast, -- start of word 2
    zoneH: [0..177B],
    zoneM: [0..377B], -- end of word 2
    beginDST: WORD, -- word 3
    endDST: WORD]; -- word 4

  dateTextRequest: PupTypes.PupType = MiscServerDefs.dateTextRequest;
  dateTextIs: PupTypes.PupType = MiscServerDefs.dateTextIs;
  dateTenexRequest: PupTypes.PupType = MiscServerDefs.dateTenexRequest;
  dateTenexIs: PupTypes.PupType = MiscServerDefs.dateTenexIs;
  dateAltoRequest: PupTypes.PupType = MiscServerDefs.dateAltoRequest;
  dateAltoIs: PupTypes.PupType = MiscServerDefs.dateAltoIs;

  lockTimeRequest: PupTypes.PupType = MiscServerDefs.lockTimeRequest;
  lockTimeReply: PupTypes.PupType = MiscServerDefs.lockTimeReply;
  resetTimeRequest: PupTypes.PupType = MiscServerDefs.resetTimeRequest;
  resetTimeReply: PupTypes.PupType = MiscServerDefs.resetTimeReply;

  timeStatsRequest: PupTypes.PupType = MiscServerDefs.timeStatsRequest;
  timeStatsReply: PupTypes.PupType = MiscServerDefs.timeStatsReply;

  TimeStatsEntry: TYPE = RECORD [
    version: WORD,
    tenexRequests: InlineDefs.BcplLongNumber,
    stringRequests: InlineDefs.BcplLongNumber,
    altoRequests: InlineDefs.BcplLongNumber,
    correction: INTEGER,
    resetAddress: PupTypes.PupAddress];
  timeVersion: WORD = 2;

  parmsOk: BOOLEAN;
  correction: INTEGER;
  resetAddress: PupTypes.PupAddress;

  statText: StatsDefs.StatCounterIndex;
  statTenex: StatsDefs.StatCounterIndex;
  statAlto: StatsDefs.StatCounterIndex;

  statPilot: StatsDefs.StatCounterIndex;
  statPilotOld: StatsDefs.StatCounterIndex;

  msg, form: Window.Handle;

  END.