I agree that a typical square wave has a 50% duty cycle. I think the case pebe is refering to is important for digital signals where the duty cycle may be anything between 0-100% for a given period. For example:
If the total time period of the digital signal is x
The digital signal is at Vmax for y periods of x
And the digital signal is at Vmin for z periods of x
Where x = y + z
Then the DC offset is calulated by:
(x*Vmax + y*Vmin)/x
This is a general solution of which the one Papabravo gave above is a spcial case where the duty cycle is 50%