sca;
close all;
clear;
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, black);
ifi = Screen('GetFlipInterval', window);
topPriorityLevel = MaxPriority(window);
Priority(topPriorityLevel);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
Screen('TextSize', window, 80);
Screen('TextFont', window, 'Courier');
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
[xCenter, yCenter] = RectCenter(windowRect);
monthsText = {'January', 'February', 'March', 'April', 'May', 'June',...
'July', 'August', 'September', 'October', 'November', 'December'};
vbl = Screen('Flip', window);
waitframes = 1;
flashTimeFrames = 1 / ifi * 0.5;
sepText = {' ', ':'};
frameCountChange = 0;
numColour = [0.9 0.1 0.1];
while ~KbCheck
matClock = clock;
yearNum = matClock(1);
monthNum = matClock(2);
dayNum = matClock(3);
hourNum = matClock(4);
minsNum = matClock(5);
secsNum = round(matClock(6));
if minsNum < 10
minsAdd = '0';
else
minsAdd = '';
end
if secsNum < 10
secsAdd = '0';
else
secsAdd = '';
end
if dayNum == 1
dayText = 'st';
elseif dayNum == 2
dayText = 'nd';
elseif dayNum == 3
dayText = 'rd';
else
dayText = 'th';
end
yearMonthLineText = [monthsText{monthNum} ' ' num2str(dayNum) dayText ' ' num2str(yearNum)];
timeLineText = [num2str(hourNum) ':' minsAdd num2str(minsNum) sepText{1} secsAdd num2str(secsNum)];
DrawFormattedText(window, timeLineText, 'center', yCenter * 0.9, numColour);
DrawFormattedText(window, yearMonthLineText, 'center', yCenter * 1.1, numColour);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
frameCountChange = frameCountChange + 1;
if frameCountChange >= flashTimeFrames
frameCountChange = 0;
sepText = fliplr(sepText);
end
end
sca;