#	Copyright 1990, Performance Systems International Inc.
#	Copyright 1988,1989 NYSERNet, Inc.
#	Copyright 1990, Sony Corp.
#	All Rights Reserved.
/VARIABLE/{
  # the manipulations below are to calculate the number of hours since
  # 00:00:00 Jan 1 1985. The calculations don't take into account leap
  # years etc., but we're concerned with differences in time, not
  # absolute time, so it doesn't matter

  split($DateO,date," ");		# split the date up
  split(date[DTime],tm,":");		# split up hh:mm:ss time
  hr = sprintf("%d", tm[THour]);
  min = sprintf("%d", tm[TMin]);
  period  = (hr * 4) + min / 15;	# period since beginning of the day

  # Having got the time, now calculate difference

  if(last[VARNAME] != 0)		# if this is not the first time
  {
    dif		= $ValO - val[VARNAME];		# get the difference

    if(dif > 0 )			#   counter was reset
    {
      printf "%d\t%d\t\"%s\"\n", period, dif, abbrev[VARNAME];
    }
  }
  last[VARNAME] = period;
  val[VARNAME]	= $ValO;		# save old value
}
