Skip to content

Instantly share code, notes, and snippets.

@biasedbit
Created March 28, 2013 19:55
Show Gist options
  • Save biasedbit/5266277 to your computer and use it in GitHub Desktop.
Save biasedbit/5266277 to your computer and use it in GitHub Desktop.
BBHTTP transfer rate proposal
struct BBTransferRate {
unsigned long bytesPerSecond;
NSTimeInterval duration;
};
typedef struct BBTransferRate BBTransferRate;
BBTransferRate BBTransferRateMake(unsigned long bytesPerSecond, NSTimeInterval duration)
{
BBTransferRate threshold;
threshold.bytesPerSecond = bytesPerSecond;
threshold.duration = duration;
return threshold;
}
NSString* NSStringFromBBTransferRate(BBTransferRate transferRate)
{
return [NSString stringWithFormat:@"%lu/s for %.0f seconds", transferRate.bytesPerSecond, transferRate.duration];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment