function timeaxis(self)

% starbeam/timeaxis -- Set time-axis labels.
%  timeaxis(self) adjusts the labels ot the time-axis
%   of self, a "starbeam" object.
 
% Copyright (C) 1998 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 25-Sep-1998 11:46:32.

if nargin < 1, help(mfilename), return, end

t0 = datenum(1968, 5, 23) - 2440000;   % May 23, 1968.

theData = pxget(self, 'itsData');
theTimeName = pxget(self, 'itsTimeName');
theVariables = pxget(self, 'itsVariables');

len = length(theVariables);

for k = 1:len
	subplot(len, 1, k)
	set(gca, 'XTickMode', 'auto', 'XTickLabelMode', 'auto')
	theXTick = get(gca, 'XTick');
	x = theData{theTimeName}(round(theXTick));
	theDateCode = 1;   % yymmdd
	theXTickLabel = [];
	for i = 1:length(x)
		if isequal(lower(theTimeName), 'tim')
			if i == 1 | i == length(x)
				theDateCode = 1;   % yymmdd.
			else
				theDateCode = 15;   % hhmm.
			end
			if (1)
				ds = datestr(x(i) + t0, theDateCode);
				if i == 1 | i == length(x)
					ds = strrep(ds, '-19', '');
					ds = strrep(ds, '009', '9');
					ds(ds == '-') = '';
				else
					ds(ds == ':') = '';
				end
				theXTickLabel{i} = ds;
			else
				theXTickLabel{i} = '';
			end
		else
			theXTickLabel{i} = int2str(x(i));
		end
	end
	set(gca, 'XTick', theXTick, 'XTickLabel', theXTickLabel)
end
