Dynamic social networking has always been the focus of the social network research, and a large number of effective community detection algorithms have been developed. However, as the real social networks are difficult to access, it is also difficult to evaluate the effectiveness of the community detection algorithms on dynamic social networks. Existing dynamic social network generators only focus on edge or node changes, whereas the quality of the community structure (modularity) is not considered. We propose a time-evolving social network generator based on modularity (TESNG-M). In TESNG-M, according to the community partition of the original network, the evolutionary behavior is simulated by adding or deleting nodes and flipping edges so that a static social network with a specified modularity will be generated. By repeating the static generation process, we obtain a dynamic social network with a specified partition and modularity at each time step. Thus, the network generated by TESNG-M can effectively simulate a real dynamic social network and be used for community detection. Furthermore, the specified modularity of static synthetic networks and the dynamic modularity of dynamic synthetic networks could be regarded as the performance baseline of community detection algorithms in static and dynamic social networks, respectively.