This is TimeCell.m in view mode; [Download] [Up]
// TimeCell.m - Category of Cell to provide setting of hour:minute:second #import <appkit/appkit.h> #import <stdio.h> #import "TimeCell.h" @implementation Cell (TimeCell) - setTimeValue:(int)timeInt { int hours, minutes, seconds; char achTime[14]; hours = timeInt / 3600; minutes = timeInt % 3600 / 60; seconds = timeInt % 60; sprintf(achTime, "%02d:%02d:%02d", hours, minutes, seconds); [self setStringValue:achTime]; return self; } - setTimeFloatValue:(double)timeDouble { int hours, minutes, seconds; double fraction; char achTime[14], achFraction[8], *pchFraction; hours = timeDouble / 3600; minutes = (int)timeDouble % 3600 / 60; seconds = (int)timeDouble % 60; fraction = timeDouble / 60 - seconds; sprintf(achFraction, "%.2f", fraction); pchFraction = index(achFraction, '.'); if (pchFraction) ++pchFraction; else pchFraction = achFraction; if (hours) sprintf(achTime, "%02d:%02d:%02d.%s", hours, minutes, seconds, pchFraction); else sprintf(achTime, "%02d:%02d.%s", minutes, seconds, pchFraction); [self setStringValue:achTime]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.