All pastes #811836 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-11 07:49 UTC
rendered paste body
#import <stdio.h>
#import <time.h>

#import "Swatch.h"

@implementation Swatch
-(float) beats {
	time_t timer=time(NULL);

	struct tm *g;
	g=gmtime(&timer);

	int hour=g->tm_hour, min=g->tm_min, sec=g->tm_sec;

	int utc=hour*3600+min*60+sec; // Greenwich, England

	int bmt=utc+3600; // Biel, Switzerland

	float beat=bmt/86.4;

	if (beat>1000)
		beat-=1000;

	return beat;
}
-(NSString*) swatch {
	return [NSString stringWithFormat:@"@%06.2f", [self beats]];
}
@end