A method for controlling a switching power converter, the switching power converter including a transformer coupled between an input terminal receiving an input voltage and an output terminal supplying an output voltage, the transformer including a core, a primary winding around the core coupled to the input terminal, and a secondary winding around the core coupled to the output terminal, an auxiliary winding around the core of the transformer having a same polarity as the secondary winding, a power switch coupled to control current through the primary winding, an active clamp switch coupled to return leakage energy to the primary winding during an off-time of the power switch, and a controller, the method comprising:
- detecting a sensed voltage by the controller in a first switching cycle, the sensed voltage based on an auxiliary winding voltage across the auxiliary winding;
- detecting timing, in the first switching cycle, of the sensed voltage satisfying a predefined condition by detecting an amount of time it takes for the sensed voltage to satisfy the predefined condition that the sensed voltage is substantially zero after the active clamp switch is turned off;
- and
- controlling, in a subsequent second switching cycle, a turn-off time of the active clamp switch relative to a turn-on time of the active clamp switch such that the detected timing of the sensed voltage satisfying the predefined condition in the subsequent second switching cycle is closer to a predefined amount of time such that the power switch is turned on while the sensed voltage is substantially zero during the second switching cycle.