Sometimes setting a range of integration results in a piecewise solution, but I think that happens only when the discontinuities depend on the independent variable and not on the dependent variables:
DSolve[{r''[t]==-r[t]-Sign[r'[t]]/10,r[0]==0,r'[0]==1},r,{t,0,30}]
Out[]=
DSolve[t]-r[t]-Sign[[t]],r[0]0,[0]1,r,{t,0,30}
′′
r
1
10
′
r
′
r
So we can manually integrate from event to event (sign change to sign change). Numerical issues arise, though, in determining the sign of the first derivative when it gets close to zero and computing the solution value. So I stopped the steps when the numbers in the coefficient got large (compared to machine-precision floats).
In[]:=
nextStep[{r0_,t0_≤t≤t1_}]:=With[{r1=Expand@Simplify@ DSolveValue[ {r''[t]==-r[t]-(Sign[D[r0,t]/.tt1+10`1000^-3])/10 ,r[t1]==r0/.tt1,r'[t1]==(D[r0,t]/.tt1)},r[t],t]},{t2=Min@SolveValues[{D[r0,t]==0,t1<t<t1+5},t]},{r1,t1≤t≤t2}];
sol=Piecewise@NestWhileList[nextStep,{DSolveValue[{r''[t]==-r[t]-1/10,r[0]==0,r'[0]==1},r[t],t],-Infinity≤t≤0},#[[2,-1]]<30&&(*trytointegrateto30*)Max@Abs@(*butstopifthenumbersgettoobig*)Cases[#[[1]],r:_Integer|_RationalNumeratorDenominator[r],Infinity]<10^20&];//AbsoluteTiming
Out[]=
{2.04366,Null}
With[{a=Min[sol[[1,2;;,2,1]]],b=Max[sol[[1,2;;,2,-1]]]},Plot[sol,{t,a,b}]]
Out[]=
Numerical methods do not have this trouble:
NDSolveValue[{r''[t]==-r[t]-Sign[r'[t]]/10,r[0]==0,r'[0]==1},r,{t,0,30}]//ListLinePlot[#,GridLines->{None,{0.1}}]&
Out[]=