Localization problem in wireless sensor networks (WSNs) has been widely studied recently. However, most previous work simply assume that all the nodes stay awake during the localization phase. This assumption clearly overlooks the common scenario that sensor nodes are usually duty-cycled in order to save energy. In this paper we propose a kind of novel DV (distance vector)-based localization algorithm which performs pretty good in duty-cycled network. In order to get a good localization accuracy, the DV-based positioning algorithms need to keep a critical minimum average neighborhood size (CMANS) for every sensor node. However, in the time-varying connectivity (TVC) (this phenomenon results from duty-cycling) network, it is difficult to keep CMANS for every node all the time. We can use CKN sleep scheduling algorithm to tackle this problem. CKN sleep scheduling algorithm can save energy while keeping certain CMANS. We further propose a novel localization algorithm: Spline Function Localization (SFL) algorithm which guarantees high accuracy even under small neighborhood size. Finally, we estimate the performance of our algorithm and compare with several classical DV-based localization algorithms (DVHOP and HCRL (Hop-Count-Ratio based Localization)) in simulation. Experimental results confirm that our algorithm has much higher accuracy under duty-cycled network.